Fixing mod_rewrite and .htaccess on GoDaddy Hosting
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!
With Firefox OS, asm.js, and the push for browser performance improvements, canvas and WebGL technologies are opening a world of possibilities. I featured 9 Mind-Blowing Canvas Demos and then took it up a level with 9 Mind-Blowing WebGL Demos, but I want to outdo...
My team mate Edna Piranha is not only an awesome hacker; she's also a fantastic philosopher! Communication and online interactions is a subject that has kept her mind busy for a long time, and it has also resulted in a bunch of interesting experimental projects...
CodePen is an amazing source of inspiration for code and design. I am blown away every day by the demos users create. As you'll see below, I have an affinity toward things that move. It was difficult to narrow down my favorites, but here they are!
One of the famous MooTools plugins is Harald Kirschner's AutoCompleter plugin. AutoCompleter takes a term input by the user and searches for matches -- an obviously help to the user. Here's how to make the most of Harald's great plugin.
The XHTML
All we...
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.
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
Thanks for such a great advice!
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.
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!
just the solution I wanted, thank you very much!! I was going crazy with this problem.
Thanks for the help
@Freddy Gonzalez:
Where is the Hosting Control Panel do you go to get extentions to work? I’m having the same problem as Rich :(
I had same problem with one of my websites. Thanks for the share.
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
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
Thanks David. I spent HOURS trying to resolve GoDaddy and their weird .htaccess ways :( until I found your Post :) Very much appreciated!
Wow! thanks.. Just moved our company website to GoDaddy and no links working! Great advice.. Fixed everything in a couple of minutes! Again, thanks!
Friends,
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
Is
Thank you.
This is the fix to mine .htaccess problems at new linux shared hosting accounts.
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.
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.
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!
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!!!
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.
THANK YOU VERY MUCH!
Thanks! This worked. I spent hours on this. So glad you figured this out.
Thanks! I spent one hour to understand why my local .htaccess was working and on godaddy’s server it didn’t.
Awesome. Don’t know how many things I tried, But finally This worked.
Thanks, I owe you a beer. (or whatever your flavor is)
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
An .htaccess file stopped working when my client’s account was upgraded to 2.2. This article fixed the issue. Thank You!
Thanks a lot. You are a true genius. Thumbs up.
Ohh Man Thanks a lot for the Solutions
Thanks. It saved my time.
GoDaddy has a very bad support.
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!!”
Thanks guys, after two hours on the internet … Thank you, solved my problem … =)
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
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!
you saved ma day man! :D
hats off, worked like a charm for me
cheers and keep it up
Thanks for the helpful information. I have created .htaccess file for my website and solved the canonicalization issue successfully.
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.
OMG I LOVE YOU! THANK YOU!!!!!!!!!!!! took me 2 days searching for this!!!
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!
Thank you Sir Thank you very much!!! Very helpful!!!!!!!!
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 .
Perfect! Just what I needed
Thank you! Exactly what I needed. Godaddy is weird.
Great that worked for me too. Thank you for this .htaccess post.
Thanks a lot ! I have same problem with 000webhost and your solution works.
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!
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. :)
Thank you very much!!! This totally worked for me!!
Thanks a lot dude, you are a saver!
Hey, It’s working, Thanks for help.
Thanks a lot! you save me once:)
I love you!
I tried everything to fix that issue. Finally I found the solution,
Thank you a lot….
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¶m2=$2¶m3=$3
Thank you david it really can help me :)
following one works for me
hii
i hosted my website in godady
but it opens only default controller
my default controller is ‘login’
but when i type http://www.jupiterinfosoft.com/login
it gives me 404 error
worked very well, thanks for this advice :)
please, please, please can someone tell me where i should enter this code (#Fix Rewrite Options -Multiviews) in the GoDaddy Web Hosting Center?
I put the following under /market/.htaccess.
However, I got the error ‘No input file specified.’
:(
Thank you David,
You are awesome!
Thanks Sir, you saved my day!
couldn’t find the solution. rewrite condition not working by adding above mentioned solution.
Please help!!!!!
Ok, so this is what I have now for godaddy shared hosting.
Thanks a hell of a lot for the still relevant fix.
Will R.
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:
Then I’m using the following to get the request value:
Thanks man! It worked for me after many other failed attempts!
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)
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 mydomain.com/specialoffer 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?
Man, that saved my ass! ~thanks!
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!
Thank you! You saved my life with this great tutorial. Before I was thinking that I have to configure mod_rewrite from cPanel.
Thanks mate, just saved my day!
Many Many thanks.
My godaddy server give 500 error.
when set
RewriteBase /
then it’s work correctly.
My .htacees is not working on godaddy server. something wrong with it
I do not want to browser files
is the following code correct, anyone?
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…
Hi, i tried this one but i am getting 500 internal server error ,
Can you help me to solve it
I can not see mod_rewrite is enabled on my vps godaddy hosting.
I have added following command to .htaccess but still not luck
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?
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.
hello. thank you David and other friends.
I am using following code:
How we can edit this to add slash to end of url?
Hi, i tried this one but i am getting 500 internal server error ,
Can you help me to solve it
just the solution I wanted, thank you very much!! I was going crazy with this problem.