Forum Moderators: phranque
We recently acquired a new domain name that points to a sub-domain on our server. We are redirecting users of the old sub-domain URL to the new domain name URL with the following rules in the htaccess of the sub-domain directory:
RewriteCond %{HTTP_HOST}!^www\.newdomainname\.com
RewriteRule ^(.*)$ [newdomainname.com...] [R=permanent,L]
It seems to work fine, but is it the most effective/best way to do this redirect? Thanks
Bill
Not quite sure what the question is... If you want to make the mod_rewrite a little more efficient, you can use "301" instead of "Permanent".
RewriteCond %{HTTP_HOST} !^www\.newdomainname\.com
RewriteRule ^(.*)$ http://www.newdomainname.com/$1 [R=301,L]
At a higher level, it would be better to point the recently-acquired domain directly to your main domain at the DNS level, avoiding the need to redirect entirely.
Jim
So what I am trying to do is keep their site hosted on my server as a subdomain, I will point the new top level domain to the subdirectory that contains their website, and redirect visitors to the old subdomain (theirname.myname.com) to the new domain name (theirname.com)
Hope that clarifies what I'm trying to accomplish. Thanks for any advice.