简体   繁体   中英

Rewrite one Domain to Another without changing Address bar

I'm in the process of changing my website from one hosting to another, however I've got the problem of how to do this.

Basically the new site on the new hosting is due to go live on Monday. However the name-servers are being changed Friday. There is another domain that is going to be parked on the old hosting.

How would I (if there is a way) point the actual domain at the temporary domain without actually changing the address bar so:

User goes to www.example.com on Thursday and sees www.example.com because it is hosted on HOST1

www.example123.com gets parked on www.example.com 's hosting Friday and the name-servers for www.example.com are changed to HOST2 .

When a user goes to www.example.com on Friday, Saturday or Sunday can I, and how would I, show the user www.example123.com but still keep the address bar as www.example.com

If there is a way to do this in either PHP or HTAccess rather than using the DNS settings that would be great. The reason we are doing this is so that when we actually go live with the site it doesn't take 2-24 hours to propagate through the internet and not be the same live time across the world.

I understand if this isn't doable but need to ask as its a precaution that my work are putting in place to avoid traffic going to the new site, and propagating early.

Thanks for any advice, assistance and solutions in advance

Link to previous post discussing differences between redirect, rewrite, and virtual hosts.

What it sounds like you're trying to do can be accomplished by setting up your new content in the new location (using a new name for testing) and then configure a rewrite or redirect, depending on how you want the client's browser to treat it (also some SEO implications), on the old site to load the new site's content. Normally, I've done this load balancers in front of the servers, but it can be accomplished with mod_rewrite as well.

One of the concerns I would have is how dynamic your content is. If "switching" sites from old to new will disrupt your customers, then you would definitely want to push them off the old servers, either by redirect or rewrite, as soon as the new name comes online.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM