Welcome to WebmasterWorld Guest from 22.214.171.124 , register , free tools , login , search , subscribe , help , library , announcements , recent posts , open posts Subscribe to WebmasterWorld
Redirecting a domain name to a subdirectory of a different domain Shatner msg:4298558 10:02 pm on Apr 15, 2011 (gmt 0) Wasn't sure where to ask this, apologies if it's in the wrong spot. So I have a primary domain, let's call it primary.com. I also have a secondary domain, let's call it secondary.com I have these directories: primary.com/one/ primary.com/two/ primary.com/three/ I would like to set up a redirect which makes the second one... secondary.com/two/ Without affecting primary.com/one/ primary.com/three/ primary.com Is that possible? I can't quite wrap my head around out how to do it, but it seems like it should be doable. Hopefully I explained that well enough.
phranque msg:4298662 12:05 am on Apr 16, 2011 (gmt 0)
what type of server is primary.com running on? Shatner msg:4298703 1:27 am on Apr 16, 2011 (gmt 0)
Linux. phranque msg:4298833 9:54 am on Apr 16, 2011 (gmt 0)
apache? Shatner msg:4299564 11:31 pm on Apr 17, 2011 (gmt 0)
Yes. Apache. phranque msg:4299707 8:29 am on Apr 18, 2011 (gmt 0)
if you put this in the .htaccess file in your document root directory it will redirect exactly the subdirectory "/two/" to the "secondary.com" domain, but none of the contents of "two" will be redirected: Options +FollowSymLinks RewriteEngine on RewriteRule ^two\/$ [ ...] [R=301,L] secondary.com is that what you were looking for? g1smd msg:4299716 8:41 am on Apr 18, 2011 (gmt 0)
Forward slashes never need escaping.
RewriteRule ^two/(.*) http://www.example.com/$1 [R=301,L]
Shatner msg:4300139 12:05 am on Apr 19, 2011 (gmt 0)
Close, but I actually do also want the contents of "two" to be redirected. At the same time if someone types in secondary.com/one/ I want it to redirect to primary.com/one/ Including all the contents on all of those directories in this. Again, apologies if I'm explaining this in a confusing way.