Fixing mod_rewrite and .htaccess on GoDaddy Hosting

By  on  

I recently launched a new website on GoDaddy shared hosting. The website required mod_rewrite for SEO-friendly URLs. GoDaddy provides mod_rewrite but every time I tried to hit a two-deep URL, I would get a 404 error. Here's what I had:

# Mod Rewrite
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

The fix to this problem was to add the following directive before my mod_rewrite directives:

#Fix Rewrite
Options -Multiviews

Tada! The URLs began working and the website's SEO has taken off!

Recent Features

  • By
    CSS Gradients

    With CSS border-radius, I showed you how CSS can bridge the gap between design and development by adding rounded corners to elements.  CSS gradients are another step in that direction.  Now that CSS gradients are supported in Internet Explorer 8+, Firefox, Safari, and Chrome...

  • By
    Interview with a Pornhub Web Developer

    Regardless of your stance on pornography, it would be impossible to deny the massive impact the adult website industry has had on pushing the web forward. From pushing the browser's video limits to pushing ads through WebSocket so ad blockers don't detect them, you have...

Incredible Demos

  • By
    Telephone Link Protocol

    We've always been able to create links with protocols other than the usual HTTP, like mailto, skype, irc ,and more;  they're an excellent convenience to visitors.  With mobile phone browsers having become infinitely more usable, we can now extend that convenience to phone numbers: The tel...

  • By
    Image Manipulation with PHP and the GD Library

    Yeah, I'm a Photoshop wizard. I rock the selection tool. I crop like a farmer. I dominate the bucket tool. Hell, I even went as far as wielding the wizard wand selection tool once. ...OK I'm rubbish when it comes to Photoshop.


  1. Rich

    Is is true that it takes an hour for go daddy hosting to even know that there is an .htaccess file there? I launched one today, but godaddy wont read:

    AddType application/x-httpd-php .htm .html
    AddHandler x-httpd-php .htm .html

    I went on google for help and found a site that said to use the above or use this:

    SetHandler application/x-httpd-php


    SetHandler application/x-httpd-php5

    but negative on both. and on another blog it said it takes an hour.

    I so hate godaddy hosting.

  2. Hey Rich!

    I have been a GoDaddy Customer for quite some time now and I had the same problem you had.

    It is not the .htaccess file – My files update within 3 minutes I use mod rewrite on my urls.

    To get extensions to work you have to go in your hosting control panel and do it. I don’t understand why but that is the only way I can get it to work.

    When you do that it will add what you put in it.

    SetHandler application/x-httpd-php5 .htm .html on top of the file.

    I hope this helped,

  3. Sexyone

    Thanks for such a great advice!

  4. Rich

    Thanks for that. Have to wait for the go ahead to make that happen. but that will definitely save me a huge headache. I appreciate it.

  5. Not trying to spam this article with links here… but I’ve got a couple of posts I wrote on messing with mod_rewrite and Godaddy. Have a look. Hope it helps!
    and an earlier one…

    Have a good one everybody!

  6. just the solution I wanted, thank you very much!! I was going crazy with this problem.

  7. Thanks for the help

  8. @Freddy Gonzalez:

    Where is the Hosting Control Panel do you go to get extentions to work? I’m having the same problem as Rich :(

  9. henlly

    I had same problem with one of my websites. Thanks for the share.

  10. Do you know of anyway with htaccess to disable someone from using your domain to point to their own website on the same server? Ex: they use to promote their PHISHING WEBSITE.COM by using this simple URL to send users : YOURDOMAIN.COM/~phishing/file.html

    Any help would be greatly appreciated. Thanks

  11. PHP Problems on Godaddy server


    Hey guys,
    I recently switched hosts to Godaddy which looks to have been a terrible mistake.
    I have a shared windows package.
    I had problems with my php scripts, no Rss feeds displayng from mylastrss so I added a php5.ini file to my root dir and that seemed to fix the rss feeds not displaying, but causes “500 internal server error, problem with resource” error for my “Yourarcade” script and Gregarius scripts.

    I could not post the files here because urls in files is detected as spam.

    Hope I am not breaking the rules by posting this link…

    Link to my php5.ini, arcade config file and .htaccess file located in the root (html) directory, did not want to paste it because of file size;

    My goal is to get the arcade (“Yourarcade script”) working (which does work without the php5.ini file in the root) but keep the php5.ini so my RSS Feeds will display, accomplishing the equivalent of the .htaccess for SEO would also be a great.

    I have a Windows + IIS shared host package and just switched hosts so I dont think the .htaccess file is serving any purpose here with the windows + IIS.

    How do I correct this problem with the arcade in the php5.ini, Do I get rid of the .htaccess file and if so how to accomplish the equivalent without it in place. I have been trying for days and can’t get it right…but then again I am a newbie lol.

  12. Thanks David. I spent HOURS trying to resolve GoDaddy and their weird .htaccess ways :( until I found your Post :) Very much appreciated!

  13. Wow! thanks.. Just moved our company website to GoDaddy and no links working! Great advice.. Fixed everything in a couple of minutes! Again, thanks!

  14. rking


    Thanks for all the post

    I was head up with .htaccess file… but still it is not working for me.

    I my server is in godaddy. I have uploaded the file ‘.htaccess’ in my sudirectory where the all html files are uploaded.

    And for the testing purpose i have changed the link in the html file ‘about_us .html’ to ‘/about_us’
    but not working…:(

    Please help me on this

  15. Gome

    Thank you.

    This is the fix to mine .htaccess problems at new linux shared hosting accounts.

  16. Dwane St.Marie

    Unfortunately this has not helped my mod rewrites to work. They work on test beds, but not on GoDaddy. I’m tired of screwing with things i shouldn’t have to be screwing with. I’m afraid I will simply save myself any more head aches and move my sites to a server that gets it right. It’s sad, but I guess you get what you pay for.

    This is the last time i get told to go do a search for answers.. GoDaddy is the problem, and i know how to fix it.

    • Andre

      to me worked.

      I just added the folowing code to the first lines.

      #Fix Rewrite
      Options -Multiviews

      If I remember at godaddy they told-me that the cause was the Apache.

      Hope you get relaxed and solve the problem.

  17. Meran

    Hello guys,

    Hope somebody can help me out…

    My blog is hosted in blogger and I am using custom domain from godaddy.

    The problem is my javascript doesn’t work in “godaddy domain” but it works perfectly with the free url that comes along with blogspot.

    How have liaised with godaddy but nobody knows what is the issue. Any idea?

    Thank you so much.

    Happy Holidays & Merry X’mas!

  18. Thomas

    I had a bizarre mod_rewrite problem. I spent hours with their tech support who finally told me to use directories with redirects rather than mod_rewrite. Here was the problem:

    This rule would not work:

    ^contact$ /contact.php

    It did not go to the error page, but rather inexplicably went to the index page.

    However the following rule would work:

    ^contact$ /leavemessage.php

    In general if a php file existed with the same base to the name as the string to be rewritten, the rewrite would send the reference to the index page. Furthermore, if I added a [F] to the rewrite

    ^contact$ /contact.php [F]

    It would still go to the index page instead of contact.php. It is clear that Godaddy is rewriting these base stems before my .htaccess file is even called. What makes it very confusing is that to see the failure you need to have the coincidence – the rewrite target is the same as the base except for the file name extension.

    Goaddy said it was apache’s doing on the default installation, so I set up my own Apache server, and no, the default install for apache works fine.

    Now the good news, after living with directory names and redirects for months

    Options -Multiviews

    fixed the problem! THANK YOU!!!

  19. Thomas

    Oh, I should mention another ‘special’ issue that Godaddy has. When I pointed this out to them they told me that they didn’t support file names with spaces in them. I am using their linux hosting. Again this works fine on a default Apache install for linux:

    This rule fails on Godaddy and takes the visitor to the index.php page instead of the “denied visits.php” page:

    RewriteRule ^denied.visits$ denied\ visits.php

    The Options -Multiview does not help with this problem.

    I do not believe them when they say they are not using a ‘default’ install. I sometimes see remnants of their work in my directories. They have something else going on before we get to the .htaccess files. It seems to be new as they went to virtual servers.

  20. Matias


  21. Thanks! This worked. I spent hours on this. So glad you figured this out.

  22. Stingus

    Thanks! I spent one hour to understand why my local .htaccess was working and on godaddy’s server it didn’t.

  23. Awesome. Don’t know how many things I tried, But finally This worked.

    Thanks, I owe you a beer. (or whatever your flavor is)

  24. Thanks a lot. I found my website’s links not working this morning (for how long I don’t know). Thanks for this fix it worked great. Same here I owe you a beer

  25. An .htaccess file stopped working when my client’s account was upgraded to 2.2. This article fixed the issue. Thank You!

  26. Thanks a lot. You are a true genius. Thumbs up.

  27. Suny

    Ohh Man Thanks a lot for the Solutions

  28. sarvesh

    Thanks. It saved my time.

    GoDaddy has a very bad support.

  29. Thanks for the tip, David. I was going mad!
    I’m helping out my nephew who is hosting his site on GoDaddy.
    I have been developing sites for almost 20 years now and believe or not, this is my first GoDaddy hosting experience!

    Weeeeeeeeeee! …..”Roller Coaster!!”

  30. Thanks guys, after two hours on the internet … Thank you, solved my problem … =)

  31. Paul from NYC

    Fucking GoDaddy!
    Thank you for this great advice.
    I spend 10 minutes to figure out wtf is going on.
    Then i found your article and it helps me a lot.
    Thank you!

    GoDaddy should die in hell

  32. Vladimir

    You don’t even imagine, how do you, fellow, helped me today. I just literally fucked my brain with that horrible godaddy hosting… I’m really a bit familiar with htaccess, but this is godmode for me.

    Really needed! Thanks a lot!

  33. you saved ma day man! :D

  34. hats off, worked like a charm for me

    cheers and keep it up

  35. Thanks for the helpful information. I have created .htaccess file for my website and solved the canonicalization issue successfully.

  36. I just wanted to say thanks for this. I recently transferred a site from Host Gator to Go Daddy and could not for the life of me figure out why my .htaccess was not acting the same. I really appreciate this useful post, well done.

  37. Rashid Tataev

    OMG I LOVE YOU! THANK YOU!!!!!!!!!!!! took me 2 days searching for this!!!

  38. You have no idea how long I wasted to figure this out. My client has a website on Godaddy and I searched inside out how to hide extensions and what ever i applied did not work.
    Finally I search for mod rewrite on godaddy and found this info and it works like miracle.
    Thank You!

  39. Anvar

    Thank you Sir Thank you very much!!! Very helpful!!!!!!!!

  40. The htaccess I used in my local development environment had the full base path after the RewriteBase /wghc
    However in my godaddy setup I used RewriteBase /
    and it worked like a breeze .

  41. Ryan Nixon

    Perfect! Just what I needed

  42. Thank you! Exactly what I needed. Godaddy is weird.

  43. Great that worked for me too. Thank you for this .htaccess post.

  44. win win

    Thanks a lot ! I have same problem with 000webhost and your solution works.

  45. Thanks so much! For anyone else in my recent predicament, this same fix works for solving redirect issues in a .htaccess file served on PHPFOG. Who knew?! Again, many thanks!

  46. Kara

    Thank you so much! This was really helpful…I had been working on removing the .php from my URLs for 3 hours, and turns out, all I needed was that first directive. Had the proper code otherwise. Phew. :)

  47. Rob

    Thank you very much!!! This totally worked for me!!

  48. Thanks a lot dude, you are a saver!

  49. Hey, It’s working, Thanks for help.

  50. Michael Chen

    Thanks a lot! you save me once:)

  51. I love you!

  52. Luna

    I tried everything to fix that issue. Finally I found the solution,
    Thank you a lot….

  53. Thank you! Thanks to this I got mod_rewrite going…. However, how do you convert the paths to parameters?

    So if the request is /dir1/dir3/dir3
    convert it to index.php?param1=$1&param2=$2&param3=$3

  54. Thank you david it really can help me :)

  55. following one works for me

    Options +FollowSymLinks -MultiViews
    # Turn mod_rewrite on
    RewriteEngine On
    RewriteBase /
    ## hide .php extension
    # To externally redirect /dir/foo.php to /dir/foo
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
    RewriteRule ^ %1 [R,L,NC]
    ## To internally redirect /dir/foo to /dir/foo.php
    RewriteCond %{REQUEST_FILENAME}.php -f
    RewriteRule ^ %{REQUEST_URI}.php [L]
  56. hii
    i hosted my website in godady
    but it opens only default controller
    my default controller is ‘login’
    but when i type
    it gives me 404 error

  57. worked very well, thanks for this advice :)

  58. Raj A

    please, please, please can someone tell me where i should enter this code (#Fix Rewrite Options -Multiviews) in the GoDaddy Web Hosting Center?

  59. Ken

    I put the following under /market/.htaccess.
    However, I got the error ‘No input file specified.’

    #Directory /market
    #Test Fix Rewrite on Godaddy
    Options -Multiviews
    # Mod Rewrite
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /market
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]
  60. Thank you David,

    You are awesome!

  61. Federico

    Thanks Sir, you saved my day!

  62. couldn’t find the solution. rewrite condition not working by adding above mentioned solution.
    Please help!!!!!

  63. Ok, so this is what I have now for godaddy shared hosting.

        Options +FollowSymlinks
        RewriteEngine on
        #Fix Rewrite (-|-) this works as a fix for crazy ass godaddy, 
        #thanks david walsh @ (!
        Options -Multiviews
        RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/$ index.php?page=$1 [L]

    Thanks a hell of a lot for the still relevant fix.

    Will R.

  64. Rick

    Was about to fix this by finding a new host, but this worked. Hope it continues to work. These 404 errors happen sporadically, not consistently.

    Here is what I have now:

    Options -Multiviews
    RewriteEngine on
    RewriteRule ^(.*)favicon.ico - [L]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.+) /index.php?$1 [L]

    Then I’m using the following to get the request value:

  65. Reggie

    Thanks man! It worked for me after many other failed attempts!

  66. Daniel

    If you want to run <?php… tags inside html in GoDaddy you should create a file .htaccess and add the following lines (mine has only these lines)

    Options +ExecCGI
    AddType application/x-httpd-php .php .htm .html
    AddHandler x-httpd-php5-cgi .php .htm .html
  67. Richard Hellyer

    Excellent … this issue had me quite mystified (tried godaddy support but they didn’t suggest this was the cause) … my symptom initially was that I was trying to do simple redirects (using Redirect) in my htaccess file but I found that in order for the redirect to work I actually had to create a blank directory or file (so eg. if I wanted to create a redirect for to another location, I would actually have to have a directory called ‘specialoffer’) and then the redirect would work!

    Anyone know if there is a way to easily determine if multiviews is set or not on one’s site?

  68. nino

    Man, that saved my ass! ~thanks!

  69. Shared hosting is such a pain in the butt. I’m on a VPS system now, and although its more work to set-up, I think it’s worth it. Cheers!

  70. Thank you! You saved my life with this great tutorial. Before I was thinking that I have to configure mod_rewrite from cPanel.

  71. Thanks mate, just saved my day!

  72. Many Many thanks.
    My godaddy server give 500 error.
    when set
    RewriteBase /
    then it’s work correctly.

  73. My .htacees is not working on godaddy server. something wrong with it
    I do not want to browser files

    Options -Multiviews
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /GWA/userImagedata
    Options -Indexes
  74. Aks

    is the following code correct, anyone?

    # BEGIN WordPress
    #Fix Rewrite
    Options -Multiviews
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress
  75. Oh my goodness, thank you so much. I’ve been searching the web for hours trying to figure out why my .htaccess file wasn’t working.

    GoDaddy has gotten another negative tick in my book…

  76. Hi, i tried this one but i am getting 500 internal server error ,

    #Fix Rewrite
    Options -Multiviews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^\.]+)$ $1.php [NC,L]

    Can you help me to solve it

  77. I can not see mod_rewrite is enabled on my vps godaddy hosting.
    I have added following command to .htaccess but still not luck

    Options +FollowSymLinks
    Options -Multiviews
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    I can see website home page but is without style sheet. Can any one help how to enable mod_rewrite module on godaddy vps hosting?

  78. venkatachalam

    I’m getting a 404 page not found except home page

    I have created my web application using kohana framework and hosted in godaddy shared hosting in httpdocs/newfolder, and i have placed .htaccess file in that folder. I’m getting 404 page not found error in all links except home page. I have attached .htaccess file here. Kindly provide any ideas regarding this issue.

    # Turn on URL rewriting
    RewriteBase /
    RewriteEngine On
    # Installation directory
    #RewriteBase /kohana/
    # Protect application and system files from being viewed
    RewriteRule ^(application|system) - [F,L]
    # Allow any files or directories that exist to be displayed directly
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # Rewrite all other URLs to index.php/URL
    # RewriteRule .* index.php/$0 [PT,L]
    RewriteRule ^(.*)$ index.php?/$0 [L]
  79. Karim

    hello. thank you David and other friends.

    I am using following code:

    Options +FollowSymLinks -MultiViews
    # Turn mod_rewrite on
    RewriteEngine On
    RewriteBase /
    ## hide .php extension
    # To externally redirect /dir/foo.php to /dir/foo
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
    RewriteRule ^ %1 [R,L,NC]
    ## To internally redirect /dir/foo to /dir/foo.php
    RewriteCond %{REQUEST_FILENAME}.php -f
    RewriteRule ^ %{REQUEST_URI}.php [L]

    How we can edit this to add slash to end of url?

  80. Hi, i tried this one but i am getting 500 internal server error ,

    #Fix Rewrite
    Options -Multiviews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^\.]+)$ $1.php [NC,L]

    Can you help me to solve it

  81. just the solution I wanted, thank you very much!! I was going crazy with this problem.

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!