Skip to the content...

Welcome to the David Walsh Blog. I'm a MooTools, Dojo, jQuery, CSS, and PHP Web Developer located in Madison, Wisconsin, United States. Please contact me if I can make your experience on my website better.

Fixing mod_rewrite and .htaccess on GoDaddy Hosting

11 Responses »

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!

Discussion

  1. rich
    November 5, 2009 @ 12:59 pm

    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

    or

    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. November 5, 2009 @ 10:07 pm

    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,
    FreddyGonzalez.me

  3. sexyone
    November 6, 2009 @ 11:23 am

    Thanks for such a great advice!

  4. rich
    November 6, 2009 @ 2:58 pm

    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. January 14, 2010 @ 5:06 pm

    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!

    http://shaferdesigns.com/coding/mod_rewrite-for-godaddy-and-wordpress/
    and an earlier one…
    http://shaferdesigns.com/coding/godaddy-htaccess-mod_rewrite-is-working/

    Have a good one everybody!

  6. January 31, 2010 @ 11:59 pm

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

  7. February 10, 2010 @ 2:44 pm

    Thanks for the help

  8. February 27, 2010 @ 3:50 am

    @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
    March 21, 2010 @ 1:13 pm

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

  10. June 8, 2010 @ 4:41 pm

    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 YOURDOMAIN.com 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. June 30, 2010 @ 4:16 am

    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;
    http://techraffle.com/php.ini.txt

    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.
    Thanks

Be Heard!

Share your thoughts with fellow developers of all skill levels! I want to hear from you!

Name*:
Email*:
Website:  
Wrap your code with <code> tags, f00!