GoDaddy mod_rewrite problem fix!

12/9/2007

This problem has been bugging the crap out of me since I started using GoDaddy hosting. All of my old mod_rewrite stuff stopped working and I had to find roundabout ways to get mod_rewrite working. I talked to GoDaddy support which is usually great but they told me they couldn’t help. I scoured the tubes o’ internet and found lots of people with the same problem, but not too many answers, and none that worked for me…until today! The problem was that Apache MultiViews were enabled by default in GoDaddy hosting (at least in their shared hosting 2.0 environment).

Apache.org docs say the following about multiviews:

The effect of MultiViews is as follows: if the server receives a request for /some/dir/foo, if /some/dir has MultiViews enabled, and /some/dir/foo< does not exist, then the server reads the directory looking for files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same media types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match to the client’s requirements.

After I finally figured this part out, it was easy to disable. Just add the following to your .htaccess file in any directory which you do not want to use multiviews:

Options -MultiViews

So… this post is really just for random people scouring the internet tubes, probably not most of my normal readers…but it’s better than nothing.

There are 23 comments in this article:

  1. On 12/17/2007 Patrick said:

    So i have been having the same problem and have scoured the internet tubes for solutions to this problem. I have tried them all and none of them worked. You gave me hope to think that your fix would also work…..however i am still without clean urls

  2. On 12/17/2007 Brandon said:

    That sucks…were you experiencing the same problems I described? I would suggest temporarily removing your htaccess file, then try navigating to a file of yours without the extension. Say, for instance, you have a file called http://www.test.com/tester.php – try going to http://www.test.com/tester and see if the page still comes up. If it does, and all of your mod_rewrite stuff is off, then MultiViews are on (like they were for me).

  3. On 01/9/2008 Waldek said:

    Thank You, Thank You, Thank You:)

  4. On 03/1/2008 michael skramstad said:

    I’m using the GoDaddy shared Linux plan and my .htaccess file isn’t working. Maybe their configuration has been changed. I want URLs that begin with http://mikeskramstad.com to redirect to the “www” version. Here’s the code:

    RewriteEngine on
    Options -MultiViews FollowSymLinks
    RewriteBase /

    RewriteCond %{HTTP_HOST} !^www\.mikeskramstad\.com$ [NC]
    RewriteRule ^/(.*)$ http://www.mikeskramstad.com/$1 [R=301,L]

  5. On 03/5/2008 Matt said:

    Thanks for that. You are my hero.

  6. On 04/7/2008 Sterling C said:

    Oh man thank you so much…. i had bought an application and thought this issue had me beat!

  7. On 04/19/2008 Can said:

    Man thank you soooo much! I’ve been looking everywhere! Your solution finally ended my problems with GoDaddy!

  8. On 06/13/2008 0w3w said:

    Man u are god!!!

    Thank’s!!! I was getting frustrated… and then puff! your magic post XD

    Thank’s!

  9. On 08/12/2008 Mod_Rewrite GoDaddy Fixed said:

    PUFF THE MAGIC BTJONES… you are the man, I wish I found this way back! thank you so much for this post

  10. On 01/14/2009 Kristopher Ives said:

    Trying it as of 2009 for my blog. If permalinks work on my blog then the MultiView hack still works.

  11. On 02/17/2009 Selvam said:

    Thanks for the great tip. You saved me a lot of time :)

  12. On 03/31/2009 scott said:

    thanks for the tip, saved me a ton of time on my wordpress install on GoDaddy.

  13. On 06/20/2009 Sergiu FUNIERU said:

    Thank you so much! You just saved my blog :)

  14. On 06/21/2009 Free Private Label Rights said:

    Thank you so much! I spend DAYS trying to figure this out…and your fix made it work in only a few seconds.

  15. On 07/26/2009 Greg said:

    Thanks so much. This works like a charm.

  16. On 09/1/2009 Daniel said:

    Thanks, i was just about to cancel the fresh opened godaddy account :D

  17. On 09/1/2009 cj said:

    dang man… took me an hour for this one…. you are a saviour..

  18. On 09/28/2009 Lloyd said:

    Hi I am having the same problem,

    I have bought a website from another developer who has said the reason for the site not working is due to the fact that godaddy Mod_Rewrite issue,

    I have added the line in above to the .htaccess file but i am still experiencing problems with website,

    Please please can someone help me out here

  19. On 10/26/2009 nick said:

    Cheers mate that helped heaps!

  20. On 11/18/2009 nick Julia said:

    Worked for me, took a little messing with but everything came out in the end. If you are hosting on your site on a shared server that has many other sites on it, make sure you type out the full domain name in the redirect portion of the htaccess file.

  21. On 11/19/2009 Loo said:

    Thank you so much for this. I’ve been using mod_rewrites on other hosting for a couple of years with no problems, but then GoDaddy didn’t work with the same rewrites. Just adding that tiny sentence fixed everything.

    Top Banana, thanks

  22. On 04/18/2010 Rick said:

    Why on earth would GoDaddy have this feature turned on by default? Have they given you an answer to that?

  23. On 05/8/2010 Milan Zivkovic said:

    Thanks, i first time configure this server so u help me to solve big problem with mod_rewrite… thanks again :)

Write a comment: