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 49 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 :)

  24. On 09/1/2010 Websphere Developer said:

    I also have an account on godaddy that is linux (because only linux accounts have mod-rewrite) and I have it working on one of my domains but cannot work on the main domain
    does anyone have the same problem?

  25. On 09/8/2010 Thomas Wright said:

    Hey man. A-fucking-plus!
    I have spent the last 2 days on the phone with godaddy trying to figure out why mod_rewrite isn’t working. You kick ass. Thank you so much!!!

  26. On 10/5/2010 Brian Richmond said:

    GoDaddy support was less than helpful to me as well when I asked how to get the rewrites working. This worked perfectly for me. Thanks SO much!

  27. On 10/27/2010 Civil Engineering Portal said:

    Oh great post. Godaddy has it enabled by default and had some problems in a script. But not after adding Options -MultiViews to my.htaccess

    Thanks again

  28. On 12/21/2010 Jon said:

    Thank u so much. It just drove me crazy until I found your post. That’s great, save me much time!!

  29. On 01/4/2011 mobile trick said:

    This post comes as a savior. The inept attitude of GoDaddy support is simply palpable. Thanks for this solution. Works great for me

  30. On 01/5/2011 David W. Beauchamp said:

    Doooooooooooddddd, Thank you!!

  31. On 01/14/2011 Trevor said:

    Wow yours was the only one to help. Thanks so much!!

  32. On 03/17/2011 chadwa said:

    THANK YOU SOOOOOO MUCH FOR POSTING THIS FIX!!!! I spent an hour trying to get this to work and finally thought of doing a search for an answer. You are a lifesaver!

  33. On 04/10/2011 Erin said:

    Thank you so much! I’ve asked GoDaddy Support a couple of times and they just tell me to check my code. I’ve been pulling my hair out about this. Who knew that I would find the answer in a 4 year old blog!!

  34. On 04/13/2011 Saibi said:

    Thanks for the fix.

    You rock man!

  35. On 06/14/2011 Jorge said:

    Thanks! I was trying to fix a problem in my rewrite rules and they were not applied. I finally solved with this!

  36. On 06/21/2011 leifjohn said:

    Thank you! This is exactly what I needed. So simple of a fix too. I was so happy to find this solution.

    I knew it was specific to godaddy because my .htaccess rewriterules worked just fine on other servers.

  37. On 07/7/2011 graham hill said:

    thanx worked great all up and running now

  38. On 07/7/2011 Alejandro said:

    GRACIAS, that is, THANKS.

  39. On 07/11/2011 So Helpful said:

    GENIUS!! This post saved me after countless hours of forum searching!

  40. On 09/5/2011 mm said:

    Thank you.Thank you. Thank you :D

  41. On 09/13/2011 Bill said:

    Beatiful! Wondered what the deal was with GD. Nice.

  42. On 09/15/2011 Matt Swensen said:

    One great big THANK YOU to you… You wrote this almost 4 years ago and it saved me today. I have been banging my head against the wall about this for hours. THANK YOU

  43. On 10/18/2011 seb_z_lite said:

    alright!! yes. it finally works. I spent so many days.only with Godaddy. Clean Urls finally..

  44. On 01/1/2012 Dan Bibbens said:

    I need help with it…

    i have the url
    http://www.youthlaxco.com/region/index.php?pg=team
    i want to change it to
    http://www.youthlaxco.com/region/team

  45. On 01/1/2012 Brandon said:

    @Dan Bibbens

    Do you have any rules set up in your .htaccess file to perform the rewrite you’re looking for? This blog post is about enabling mod_rewrite in GoDaddy’s hosting environment since it seems they sometimes have multiviews enabled which interferes with mod_rewrite. Writing the rules themselves is a completely separate task.

    That being said, you’ll need to add some code similar to the following in your .htaccess file. This is just scratching the surface with what mod_rewrite can do and you may end up needing something more complex:


    Options -MultiViews
    RewriteEngine On
    RewriteRule ^region/([^/\.]+)/?$ region/index.php?pg=$1 [L]

  46. On 01/1/2012 Dan Bibbens said:

    @Brandon

    I new to this.
    For the .htaccess file—–will it need to be placed in the main root directory or the /region/ directory… so i can get a better understanding how it works.

    Is there a delay with godaddy?

  47. On 01/1/2012 Dan Bibbens said:

    @Brandon
    I have all of the files of the region placed in the root folder on godaddy.

    so it would be w/o region

    Options -MultiViews
    RewriteEngine On
    RewriteRule ^/([^/\.]+)/?$ /index.php?pg=$1 [L]

  48. On 01/1/2012 Brandon said:

    @Dan Bibbens

    You’ll want it in your root directory in the example I gave you. And yes, I have seen some delays with GoDaddy before which is really frustrating. Not sure how long the delay is though (maybe 15 minutes or an hour?), it’s been a few years since I did any real mod_rewrite work with GoDaddy and I don’t remember the specifics of the delay.

    The code you posted should work if you move it into the region directory. Otherwise, what you posted would work to rewrite this http://www.youthlaxco.com/team to this http://www.youthlaxco.com/index.php?pg=team which could be what you want.

  49. On 01/1/2012 Dan Bibbens said:

    @Brandon

    Thank your for the help.

    I will give that a shot.

Write a comment: