替换 htaccess 中的主机
我正在创建一个位于我的网络服务器上的 /shop/ 的网站。它有一个单独的域。
现在,我想更改传入的每个请求。
http://techinf.de/shop/ 应成为 http://holzwerkstatt-osel.de/ 并且 http://www.techinf.de/shop/ 应变为 http://www.holzwerkstatt-osel.de/
实际请求,如product.php?id=2必须相同。
I am creating a website which is located in /shop/ on my webserver. It has a seperate domain.
Now, I want to change every request that comes in.
http://techinf.de/shop/ shall become http://holzwerkstatt-osel.de/ and
http://www.techinf.de/shop/ shall become http://www.holzwerkstatt-osel.de/
the actual request, like product.php?id=2 must be the same.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您想要保留
www
(或缺少该内容),因此您可能需要使用mod_rewrite
来实现此目的。以下内容应该有效:编辑:如果您不关心整个
www
内容,只需在technif.de 上使用
应该可以工作:mod_alias
这将获取
/shop
之后的所有内容并将其附加到重定向 URL,然后进行重定向。因此/shop/product.php?id=2
变为http://holzwerkstatt-osel.de/product.php?id=2
等。Since you want to persist the
www
(or lackthereof), you likely do need to usemod_rewrite
for this. The following should work:Edit: If you don't care about the whole
www
thing, just usingmod_alias
ontechnif.de
should work:This takes everything after
/shop
and appends it to the redirection URL, then redirects. So/shop/product.php?id=2
becomeshttp://holzwerkstatt-osel.de/product.php?id=2
, etc.