A while ago I wrote a tip about problems geting SEF URL's work on 1&1-s servers. Back then I didn't realized, that the problem is the same - or at least fairly similar - on GoDaddy's servers too. Not everywhere, I have a site running on GoDaddy with sh404SEF without any need of tweaking the .htaccess file, but recently I had issues with another site.

So, the trick above solves the problem, but what is the cause?

As you might guessed already, the problem is how their servers are set up. Sadly, by default the servers are using PHP4 to handle .php extension by default. This need to be overwritten by the .htaccess rules as per original tip. After digging a bit around, and comparing the two accounts, I discovered this: GoDaddy sets a default PHP version for your hosting account. On newer accounts you can change this settings from the GoDaddy's account management interface.

As per a Knowledge base article found on GoDaddy, the PHP files are handled like this:

  • .php files - using your hosting account's PHP version.
  • .php4 files - using PHP 4
  • .php5 files - using PHP 5

Why they are doing so? One common reason for doing this is that hosts leave PHP4 configured with register_globals ON in order to support legacy code while offering PHP5 with register_globals OFF.

If you are on a shared server at a host that has configured register_globals ON server wide, you should be very worried!

Turning register globals OFF via a local php.ini or a .htaccess file will NOT offer you any extra protection. Another exploited account on your server can simple hack yours. For server security, and since php 4.2, register globals is OFF server wide by default (php default). Any host overriding this is inviting trouble. If you need register globals ON for a specific site, simple use a .htaccess file for that specific directory, and server wide security will not be compromised. Of course, if you do this be sure all effected scripts fully sanitize input data.

These being said, let's go back to the solution. To run sh404SEF - and generally, SEF URL's on your recent Joomla distributions, you need the .php files to be interpreted using PHP5. So, you need to use the first combo in your .htaccess file. Other tips are here mostly to see what you might see already there - and what those settings are for.

The following entries in a directory's .htaccess file designate PHP files to run under PHP 5 and PHP4 files to run under PHP 4.

AddHandler x-httpd-php5 .php
AddHandler x-httpd-php .php4

Hosting accounts should use the following entries for CGI:

AddHandler x-httpd-php5-cgi .php
AddHandler x-httpd-php-cgi .php4

Or, 4GH accounts can use these entries with FastCGI:

AddHandler x-httpd-php5 .php
AddHandler x-httpd-php .php4

If you want your 4GH account to use PHP 5.3.x instead of PHP 5.2.x, use the following entry:

AddHandler x-httpd-php5-3 .php
NOTE: GoDaddy only offer PHP 5.3.x with fastcgi using fcgid. Changes made to an existing .htaccess file will be seen immediately. When creating new .htaccess files or deleting existing .htaccess files, you might not see changes for up to an hour.

There is one more problem you might have using GoDaddy's servers to host multiple domains - but this is not a GoDaddy specific problem, you might have on any server where you have the option to use so called "Addon Domains" - domains over your main account domain, which are pointing to ANOTHER site - generally hosted in a subdirectory of your hosted account. If you have problems with these "Addon domains", you might need to tweak an existing line of your .htaccess file.

Look for this line:

# RewriteBase /

Uncomment it by removing the # from the front of the line, and change it to match your setup.

For example, if the second-domain.com is pointed to show the content of /second-domain directory, then the correct line is

RewriteBase /second-domain

Don't do this, unless you are experiencing problems with the default settings!

Category: Joomla Troubleshooter