Making the .htaccess SEF URLs Work With Godaddy Hosting

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 20 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 13415 2009-11-03 15:53:25Z ian $
# @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
##


#####################################################
#  READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations.  It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file.  If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's.  If they work,
# it has been set by your server administrator and you do not need it set here.
#
#####################################################

##  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!
#
## Deny access to extension xml files (uncomment out to activate)
#<Files ~ "\.xml$">
#Order allow,deny
#Deny from all
#Satisfy all
#</Files>
## End of deny access to extension xml files
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 /


########## Begin - Joomla! core SEF Section
#
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]
#
########## End - Joomla! core SEF Section

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!

Security & SSL

We take data security very seriously. Thus, your information is encrypted by a bank-grade, 256-bit SSL certificate during all secure transactions performed on our website.

Find Us

OS Ignite, Inc.
3420 Bristol St, Fl 6
Costa Mesa, CA 92626