Welcome to WebmasterWorld Guest from 54.145.144.101

Forum Moderators: phranque

Message Too Old, No Replies

Redirecting a domain name to a subdirectory of a different domain

   
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.
12:05 am on Apr 16, 2011 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



what type of server is primary.com running on?
1:27 am on Apr 16, 2011 (gmt 0)



Linux.
9:54 am on Apr 16, 2011 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



apache?
11:31 pm on Apr 17, 2011 (gmt 0)



Yes. Apache.
8:29 am on Apr 18, 2011 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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\/$ [secondary.com...] [R=301,L]

is that what you were looking for?
8:41 am on Apr 18, 2011 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Forward slashes never need escaping.

RewriteRule ^two/(.*) http://www.example.com/$1 [R=301,L]
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.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month