How to fix .htaccess file for mod_rewrite and addhandler on godaddy subdomain

Posted by jtpratt |22 Jan 08 | 21 comments

I’m writing this article specifically for people hosted on godaddy that have had the following .htaccess, mod_rewrite or addhandler problems on shared or premium hosting accounts for various open source applications, such as (but not limited to) WordPress, Drupal, BBPress, Moodle, Geeklog, PHPNuke, Postnuke, and more!

Short list of potential issues:

  • problems with permalinks in WordPress
  • problems with clean URL’s in Drupal
  • problems with pretty url’s in BBPress
  • problems with WordPress MU
  • ANY mod_rewrite problems in a sub-directory, subdomain, sub-folder, mapped domain, i.e., a domain you setup in goDaddy’s Domain Management -> Assign Domain to Hosting Site feature

I have struggled with two issues time and time again on a goDaddy shared or premium account. If I go into “Domain management -> Assign Domain” and “map” a domain to a folder of the root URL, I have problems with any site that needs to use an .htaccess file for “rewrite” the URL’s using a feature called “mod_rewrite” – especially WordPress and Drupal.

I came across a fix today that made all those problems go away forever. To be able to do what I’m about to tell you, you must also be hosting your domain name with goDaddy.

In your godaddy control panel, go to “Settings -> Domain Management”.

Click on “Add New Record
add new dns record in godaddy dns control panel

In the very first line note the IP address of your “@” host, as you’ll by typing this into the box that comes up when you click to add a new record. In the first field type an asterik (*). In the second field type the IP address of your “@” host. Leave the drop down at one hour. Click “ok” to save.
adding a host record

That’s it – you’re done! There should be no fiddling with your .htaccess files at all.

Once I applied that simple fix – everything worked again.

I’ve also had problems when I’ve attempted to get .html or .htm files to parse PHP code as if they were .php files on goDaddy, or with applications that had to use PHP5. That fix is also really, really easy. All you have to do is create an .htaccess file with the following 2 lines:

AddHandler x-httpd-php5 .php
AddHandler x-httpd-php .php .htm html


21 Responses

  • cscelza/ 24 Jan 08 @ 9:13 PM

    Thanks for figuring this out.

    One suggestion, I believe you meant “Settings -> DNS Manager” instead of “Settings -> Domain Management”…

    Otherwise, excellent information.

    Please edit (or delete) this comment after you edit you instructions.

    Thanks again.

  • Pink Munoz/ 16 Mar 08 @ 12:34 PM

    I was wondering, what about build a niche store type sites? Is there any way to put them on a subdomain without problems?

    Pink Munoz’s last blog post..Depression Glass Patterns

  • erica Munoz/ 16 Mar 08 @ 12:35 PM

    is there a way to get bans sites to work like this?

    erica Munoz’s last blog post..Depression Glass Patterns

  • admin/ 21 Mar 08 @ 3:09 PM

    When I did this I was able to get my BANS site to work…

  • Bjorn/ 04 May 08 @ 8:52 PM

    WOW! Thanks! This worked for me with WordPress!

  • explorish/ 22 May 08 @ 2:30 PM

    hi,
    i tried this too, but it said the subdomain is not valid! :(
    any clue?

  • Joe Chellman/ 01 Jul 08 @ 10:20 PM

    This was helpful to me. Very strange that setting up a wildcard could fix the mod_rewrite issue, but i’ll take it!

  • ken/ 27 Aug 08 @ 12:23 PM

    thanks.

    this was so helpful, i’m putting a link back to you on my site.

    ken

  • admin/ 27 Aug 08 @ 12:25 PM

    @Ken – thanks! That’s why I posted it, it was the instructions that “I” was missing when I had the same problem! =)]

  • Jian Zhan/ 28 Sep 08 @ 1:12 PM

    many thanks

    It works perfect.

    It is very helpful for many people

  • Trader Vic/ 26 Oct 08 @ 6:12 PM

    Thanks, this worked like a charm! Saved me a ton of time messing with .htaccess to no result, much appreciated.

  • onThesource.com/ 26 Nov 08 @ 9:41 AM

    hi, but I can not find “add a new record” at Godaddy panel. What should I do? Thanks!

  • Andrea/ 09 Mar 09 @ 1:10 PM

    Have you seen a situation in which this STOPPED working? I followed your advice on another domain and just tried it again for a different domain. Now, all of a sudden this doesn’t work. What do you think?

    Andreas last blog post..Araceli’s Fashion Picks: Mona Lucero Brings the Glam!

  • Shane/ 16 Mar 09 @ 2:58 PM

    <thanks> man, this was the solution i needed. Searched forever on drupal forums – everyone else was sure it was just a poorly configured .htaccess file. </thanks>

  • Oren/ 25 Mar 09 @ 10:49 AM

    I did this but subdomains still don’t work with mod_rewrite for me.
    I have an economy linux hosting plan in godaddy and im using a wordpress blog with the wordpress-subdomains plugin – http://webdev.casualgenius.com/projects/wordpress-subdomains

    please help me!

  • Andrea Merida/ 26 Mar 09 @ 5:48 PM

    Oren, you can’t have multiple domains with GoDaddy’s economy plan. You have to upgrade to deluxe, unfortunately. Just be careful not to run any Drupal sites on that hosting account, because it will be super slow.

    I am not sure if GoDaddy allows economy hosters to have multiple subdomains. Try going through “My Hosting Account” and choosing “my domains.” You should be able to set them up there.

    Andrea Meridas last blog post..What happened to Dobizo?

  • Oren/ 27 Mar 09 @ 12:31 AM

    In fact I did manage to run the plugin. I have contacted their support and they told me that I need to purchase a dedicated IP (2.99$/month) and now it works.

  • Greg Kozna/ 26 Apr 09 @ 4:24 AM

    This is very helpful for many people
    This was the solution I needed, I have been at it for days trying to get my rss feeds working.
    Worth mentioning again go to DNS manager not domain managment
    Thanks again.

  • Khampol/ 18 Jun 09 @ 9:59 PM

    How to say : Thank you , Merci ! It works ! Incredible, I plan to move away from godaddy … I stay :-)

    1000 Merci !

    K.

  • khalid/ 12 Dec 11 @ 7:59 AM

    hi,i am on hostgator.any body have any idea how to fix this problem on hostgator.

You must be logged in to post a comment.