Blank Banner
Perfect .htaccess for Joomla! with Godaddy Hosting
Written by Zach   
January 29, 2010

Help! My .htaccess doesn’t work on Godaddy hosting or ‘blablabla’ hosting. I hear this a lot, and as a professional website developer I have used Joomla! with search engine friendly URLs on more hosts than I can count.  There are some that are trickier than others and even a few that just plain won’t work no matter what.

Most of the people having problems with their .htaccess file on various hosts are having the problem because of two simple reasons.

The Nasty 500 Internal Server Error

Either, #1, the host doesn’t support certain directives in the file, which often will result in you getting a 500 internal server error after enabling the .htaccess file.  I used to get this error quite a bit with Godaddy hosting, but it has since been fixed.  Or, #2, the .htaccess simply needs time to be read and accepted by the server, as some hosts will cache the file and not register changes to it for varying amounts of time.  Again, Godaddy used to have this problem quite  a bit.

Anyway, here is an .htaccess file that is guaranteed to work on Godaddy hosting. NOTE! You might need to wait up to 30 minutes before activating SEF Urls in the Joomla! administrator console.  Although they claim that they have stopped caching the .htaccess file for so long, there still might be some delays before it registers.

Also, I have literally used this EXACT .htaccess file on over 10 different Godaddy hosting accounts and it has worked fine.  All of them were Linux, of course, and using PHP 5 but it shouldn’t matter.

##
# @version $Id: htaccess.txt 10492 2008-07-02 06:38:28Z ircmaxell $
# @package Joomla
# @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##

##  Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

#
#  mod_rewrite in use

RewriteEngine On

########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits

#  Uncomment following line if your webserver's URL
#  is not directly related to physical file paths.
#  Update Your Joomla! Directory (just / for root)

# RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

To Workaround or Not to Workaround

I have seen many sites suggesting various work arounds and commenting out of certain lines, but honestly, this one works and if it doesn’t…well…I’d be very surprised to hear that.  Also, be careful that you don’t mis-interperate the ‘RewriteBase’ command.  You should leave it commented out in most cases, even if you are hosting multiple domains within the same hosting account.  This command is only used when you have a Joomla! installation in a subdirectory of a single domain.  So, even though you might have a second site yoursite2.com within a sub-directory of your main FTP called /yoursite2/ the RewriteBase still does not need to be changed.  It is only if you installed Joomla! into a sub-directory of a domain so you can access it at www.yourdomain.com/yoursubdirectory/.

Good luck!

 

Advanced Quote

Utilized our advanced quoting form to get an estimate on your project quickly.

We'll get as much detail as possible so that we can create a solution that gives a proper return on investment.

Complete Quote Request Form Now...

   

Pricing Information

Pricing a website development project is tough, but read the articles and resources below to get an idea of what we can offer.

Website Pricing EstimatesThe Development ProcessProject Price Calculator