Forum Moderators: phranque

Message Too Old, No Replies

rewrite domain1 to sub.domain2

people visit domain2.com but get stuff from sub.domain1.com

         

wkossen

12:19 pm on Dec 15, 2010 (gmt 0)

10+ Year Member



I have searched, googled, binged and yahooed, and then some more. but I can't seem to find a rewrite solution to get people to access content from sub.domain1.com while visiting domain2.com. Many solutions the other way around, but this seems to not exist.

I don't want a redirect, because I want people to see domain2.com and not sub.domain1.com

I want this to work with anything that trails the host part of the url.

How am I going to get this to work?

If this is a dupe question after all, please point me to the answer.

Thanks

Willem

(i tried and tried to get rid of stupidity, but somehow I fail)

jdMorgan

4:10 pm on Dec 16, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The answer depends on exactly how "sub.domain1.com" relates to the physical server, the virtual host, and the filespace of domain2.com.

If these two hostnames share the exact same filespace, then nothing need be done at all -- It will 'work' the way you want it to, but you may want to prevent direct access to sub.domain1.com.

If the two hostnames are on different servers, then you'll need to proxy requests for domain2.com over to the sub.domain1.com server. This requires that you have server configuration access on both servers if you wish to implement it completely and correctly. And this option won't be available if you're on shared hosting.

If you're on shared hosting, and have used a "control panel" to set up the sub.domain1.com hostname as an "add-on domain", then an internal rewrite from domain2.com to sub.domain1.com's filespace is all that is needed. However, if it is domain2.com that has been declared as an add-on to sub.domain1.com (or to domain1.com), then no solution may be possible unless you switch from a name-based virtual host to an IP-address-based virtual host -- That is, pay for and get a "unique IP address" allowing you to 'map' any hostnames you wish to any server filespace you wish, free of the control panel restrictions. (It is possible you may be able to use unix symlinks if you have console login on this server, but again, that's not likely on shared virtual hosting.)

So, all in all, the answer is "It depends." It depends on what type of hosting account you have, and how your hostnames are currently mapped to server filespace.

Jim

wkossen

9:10 pm on Dec 19, 2010 (gmt 0)

10+ Year Member



First, this applies to me: If you're on shared hosting, and have used a "control panel" to set up the sub.domain1.com hostname as an "add-on domain",

I have however the option to set all sorts of things in .htaccess which is 'close to access to server config'

I have indeed 'namebased vhosts' and no 'unique IP address' per site, but all sites are hosted on the same IP.

I have been trying several rewrite rules but can't seem to get what I want which is that visitors see domain2.com but get their stuff 'under water' from sub.domain1.com. A redirect doesn't cut it, since it will show the sub url. and since I don't know each sub path in sub.domain1.com, I can't redirect each page separately. I need some sort of 'catch-all'-rewrite to fetch the stuff from the sub-url and present it on the domain2.com.

Is this 'the can't-be-done' case?

jdMorgan

12:22 am on Dec 21, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Already answered:

If you're on shared hosting, and have used a "control panel" to set up the sub.domain1.com hostname as an "add-on domain", then an internal rewrite from domain2.com to sub.domain1.com's filespace is all that is needed. However, if it is domain2.com that has been declared as an add-on to sub.domain1.com (or to domain1.com), then no solution may be possible unless you switch from a name-based virtual host to an IP-address-based virtual host...


If your situation corresponds exactly to one of these cases, then take the conclusion for that case.

Jim