开发者

Replacing subdomain of a URL

开发者 https://www.devze.com 2023-03-15 02:55 出处:网络
I\'ve got a customer that has two websites, the only difference being the subdomain. Let\'s call them www.customerwebsite.com and front.customerwebsite.com. The front subdomain is basically a front en

I've got a customer that has two websites, the only difference being the subdomain. Let's call them www.customerwebsite.com and front.customerwebsite.com. The front subdomain is basically a front end, whereas the www is a backend that's being used the majority of the time by users.

The issue is that they REALLY d开发者_高级运维on't like the subdomain showing up and would love for their users to just see the standard www instead of front before every page. While I explained that this could potentially cause issues, they still want to explore the idea.

Is there any way I can do a replace on the subdomain via apache2 .htaccess so the user sees www.customerwebsite.com but is actually pointed to front.customerwebsite.com? Will it cause issues because www.customerwebsite.com is actually a different page?


Are the two hosts effectively hosted on the same server? If so, you might be able to find a solution using mod_rewrite (not using redirections, but rewrites). I'm not sure how this would work across multiple VirtualHosts, though.

Otherwise (and more generally), you should be able to use mod_proxy_http and set up a reverse proxy from the www. host to the front. host. It's possible that the front. site may need to be modified slightly, if certain features require it to be aware it's using www..


You can certainly set up www.example.com to be a copy of front.example.com using a ProxyPass rule similar to this:

ProxyPass http://www.example.com/ http://front.example.com/

Here's the docs for mod_proxy: http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Unless I'm confused by what you're asking, this will cause some problems. Most notably, there won't be any way to reach the current www.example.com because all requests will be proxied to front.example.com.

0

精彩评论

暂无评论...
验证码 换一张
取 消