Getting mod_rewrite to work on Godaddy

Author: Steven Neiland
Published:

Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

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 /

Reader Comments

Mangaldeep's Gravatar
Mangaldeep
Monday, January 16, 2017 at 11:47:24 PM Coordinated Universal Time

My .htaccess file is not working on the godaddy linux hosting server but working on localhost plz reply me

  • Please keep comments on-topic.
  • Please do not post unrelated questions or large chunks of code.
  • Please do not engage in flaming/abusive behaviour.
  • Comments that contain advertisments or appear to be created for the purpose of link building, will not be published.

Archives Blog Listing