.htaccess 301 Redirect on GoDaddy Shared Hosting
I recently needed to change the domain of our Eagle Crest Vacation Rental website from www.EagleCrestGetaway.com to www.CentralOregonGetaway.com. I wanted to make sure that I did it in the most “search engine friendly” manner possible, every page matched up from one site to another, and it didn’t take forever. I decided to use the .htaccess file to redirect all the files from one domain to another.
Both of the websites were hosted on GoDaddy shared hosting plans on Linux operating systems. Here is how you create and then use the .htaccess file to forward all the pages in a domain to another.
1) Create a text file with the following text on a single line:
Redirect 301 / http://www.NewDomainName.com/
NOTE: Make sure you use a program like text edit or notepad and save the file in plain text formatting. Also make sure you turn line wrapping etc off.
2) Save the file as htaccess.txt (you will change the name later I promise)
3) Upload that file to the home directory of your web server using your favorite FTP program
4) Change the permissions of the file to 644 so that the server can write to it but the file is not accessible to the browser.
5) Change the name of the htaccess.txt file to .htaccess
6) Wait for the magic to happen. Depending on the configuration of your server it may take 15 minutes or so for any .htaccess file changes to propagate.
GoDaddy shared hosting plans DO allow .htaccess commands so performing a 301 redirect as I did with our Eagle Crest site is your best bet in both time of execution and effectiveness.
Technorati Tags: GoDaddy, .htaccess, 301, redirect
July 15th, 2008 at 11:56 am
Your instructions are crystal clear and to the point. Thank you!
Your instructions also reinforce what I’ve learned from other resources. However, I can’t get this to work for some reason. I realize that you are probably not techheads, but since you are using the same GoDaddy Linux hosting service that I am, I thought maybe I would post this question to you and see if you had any ideas about what my trouble is:
I’m trying to redirect from my main domain URL (i.e. http://www.example.com) to a subdirectory (i.e. http://www.example.com/blog)
I know I can do this with a subdomain like http://blog.example.com, but I don’t want that. I want users to visit www.example.com and see the content located at www.example.com/blog.
When I put the redirect in the .htaccess file as you and others have instructed, the redirection seems to get stuck in some weird loop such that the target URL looks something like:
http://www.example.com/blog/blog/blog/blog/blog/blog…..
etc…
It’s obviously trying to do the redirect, so I know the .htaccess file is being read. But the redirect itself is messing up somehow.
Any ideas?
Thanks