View Full Version : .htaccess domain re-direct
dropandhop
Nov 12th 2007, 10:57 am
Hi all,
Hope that you can help.
I would like to re-direct www.olddomain.com and all of its files and subdirectories (like www.olddomain.com/test.html) to the index of www.newdomain.com
I tried to use the following code:
Redirect 301 / http://www.newdomain.com/
It worked great when I hit www.olddomain.com but when I tried to hit www.olddomain.com/test.html it tried to bring me over to www.newdomain.com/test.html not to the index file of the newdomain.com (not what I wanted it to do as it won't work b/c that file doesn't exist anymore).
I would appreciate any help you can offer.
Thanks again!
A
Jean-Luc
Nov 12th 2007, 11:37 am
Hi,
I would try this:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.oldomain.com$
RewriteRule ^(.*) http://www.newdomain.com/ [L,R=301]
Jean-Luc
Nintendo
Nov 12th 2007, 11:45 am
Options +FollowSymLinks +Indexes
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)$ http://www.newdomain.com/ [R=301,L]
dropandhop
Nov 12th 2007, 11:46 am
Hi Jean-Luc,
Thanks for your reply!
Unfortunately that didn't seem to work. With that .htaccess file in place it didn't re-direct at all (when going to both www.olddomain.com and www.olddomain.com/test.html)
Any other ideas?
Thanks again,
A
dropandhop
Nov 12th 2007, 11:49 am
Nintendo,
Thanks a ton...that seemed to do a trick!
Now, my question for you is, do I loose loose page ranks with this method? I thought that using a 301 was the best way to go so that you don't loose page ranks.
Any thoughts?
Thanks!
A
Nintendo
Nov 12th 2007, 8:09 pm
PR will probably go to the new page.
dropandhop
Dec 3rd 2007, 11:10 am
I am trying to do one more simple redirect, while keeping my existing redirect intact.
While still redirecting to the newdomain (as per below) I would like to make an exception and redirect one specific file as such:
www.olddomaincom/pdf/notes.pdf
to
www.newdomaincom/images/stories/notes.pdf
Below is what I am currently using.
Options +FollowSymLinks +Indexes
RewriteEngine on
RewriteBase /
RewriteCond %{REMOTE_HOST} !^ipaddress\.ipaddress\.ipaddress\.ipaddress
RewriteRule ^(.*)$ http://www.newdomain.com/ [R=301,L]
Thanks again for any help you can provide, I just can't seem to get it!
Nintendo
Dec 4th 2007, 1:37 am
RewriteRule ^pdf/notes.pdf$ http://www.domain.com/images/stories/notes.pdf [R=301,L]
I think after the
RewriteRule ^(.*)$ http://www.newdomain.com/ [R=301,L]
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.