Web Hosting Geeks | Web Hosting Experts
Need help? Call us 1(866)TOP-HOST

14611 reviews 1734 hosting providers

Questions & Answers

.htaccess redirect issue

May 17, 2012 by TheRock
Hi,

I want to set up an .htaccess redirect so that all URLs for an account will be redirected. I need every incoming URL to redirect to the newdomain.com/subfolder/ URL.

I have the following HTML code in the site root .htaccess file:
Redirect 301 / http://www.newdomain.com/subfolder/
the redirect does not work correctly if the "incoming" URL is :

http://olddomain.com/site/site1/index.html

The redirect does occur, but it goes to URL:

http://www.newdomain.com/subfolder/site/site1/index.html

And that creates an error 404, since that page does not exist on the newdomain.com website.

Can anyone help me fix this?

Thanks

2 Answers

0 votes
May 17, 2012 by WebProX
hi there,
If there are no files on the old domain, you could use the 404 error document option to redirect the user for any URL, you could set up each error document type to cover all of the common errors.

Set up a 301 redirect .
Code:
Redirect 301 / http://www.newsite.com/
ErrorDocument 400 http://www.newsite.com/
ErrorDocument 401 http://www.newsite.com/
ErrorDocument 403 http://www.newsite.com/
ErrorDocument 404 http://www.newsite.com/
ErrorDocument 500 http://www.newsite.com/
0 votes
May 17, 2012 by randy999