Getting mod_rewrite to work on Godaddy

Published: {ts '2010-10-02 00:00:00'}
Author: Steven Neiland
Site Url: http://www.neiland.net/article/getting-modrewrite-to-work-on-godaddy/

A few months back I developed a site for an accounting firm which was hosted by godaddy. Everything worked fine up until the point I uploaded the .htaccess file for the seo urls. For some reason it was being completely ignored.

The Diagnosis

After some time doing research on google and forums I narrowed the problem down to a few key points.

  1. Changes to a .htaccess file can take an hour to come into effect. (Im not sure what system configuration can create this behaviour.)
  2. GoDaddy enables Multiviews but seems unable to handle them correctly.
  3. RewriteEngine is turned off by default
  4. FollowSymlinks is turned off by default
  5. Its been mentioned but I cannot verify, that php files get processed before the htaccess rules.

The Solution

The solution to these problems is to prepend the following lines to your .htaccess file and if at first they dont seem to be working wait an hour and reconfirm which I'm sure you will agree is both a pain and totally insane.

With regards the php files being processed first I have not seen that behaviour myself so it may have been a bug that GoDaddy has corrected.

One other thing to note was that some bloggers mentioned having to set the RewriteBase. I dont think it is necessary but just in case I am including it in the code.

Options +FollowSymLinks Options +Indexes Options -MultiViews RewriteEngine On RewriteBase /