geomouchet
asked on
Redirect domain to subdomain. Show domain in address bar.
I have a main domain: domain1.com and a subdomain: sub.domain1.com. I have another domain: domain2.com. I would like requests for www.domain2.com to go to sub.domain1.com, but have the browser address bar show www.domain2.com. The .htaccess file below is close to what I want, except the address bar shows sub.domain1.com instead of www.domain2.com. How can I fix this?
RewriteEngine On
Options +FollowSymlinks
RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com$ [NC]
RewriteRule ^ http://sub.domain1.com[R,L]
ASKER
caterham_www: Thanks for your help. I'm kind of lost with this htaccess stuff. I tried your rewriterule, but it gives a 404 error. If it makes a difference, at my host the main domain directory is /www/www and the subdomain is /www/sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window