Forum Moderators: phranque
I have a website and I have a directory in it which is related to travel only.I buy a new domain and I want to redirect this directory to my new domain without losing my search rankings. What's the best method.
This is what I want to accomplish,
www.mysite.com/mydirectory(old domain) ---> www.mydirectory.com (new domain)
How can i use mod rewrite using htaccess so that i can completely redirect directory and all files under it to new domain.
Thankx.
RewriteCond %{HTTP_HOST} mysite\.com\mydirectory [NC]
RewriteRule (.*) http://www.mydirectory.net/$1 [R=301,L]
RewriteCond %{HTTP_HOST} mysite\.com\mydirectory [NC]
RewriteRule ^mydirectory/(.*) http://www.mydirectory.net/$1 [R=301,L]
RewriteEngine on
RewriteBase /
RewriteRule ^mydirectory/(.*) http://www.mydirectory.com/$1 [R=301,L]
[edited by: Mahavir at 10:56 am (utc) on April 12, 2008]
[edited by: jdMorgan at 12:54 pm (utc) on April 12, 2008]
[edit reason] de-linked [/edit]
However, you can only delete the RewriteCond line if mysite.com and mydirectory.com are hosted on separate servers, or in completely-separate accounts on one server.
It's not clear from what you've posted whether these domain are hosted together or apart, though.
"RewriteBase /" is the default. You don't need to use that line, unless you need to override a previous RewriteBase directive in this file.
Jim