使用apache vhost配置重定向到新域 [英] Redirect to a new domain using apache vhost configuration
本文介绍了使用apache vhost配置重定向到新域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个如下的apache虚拟主机配置.我希望所有来自
I have an apache vhost configurations as below. I want all my requests from
somedomain.com/loadproduct?product=dell-inspiron-15
要重定向到
someotherdomain.com/dell-inspiron-15 .
我可以从vhost配置中执行此操作吗?请注意,我在网址中有查询参数.
Can I do this from vhost configuration? Note that I have query parameters in the url.
Listen 12567
NameVirtualHost *:12567
<VirtualHost *:12567>
ServerName somedomain.com
ProxyPreserveHost On
RewriteEngine On
RewriteRule ??
</VirtualHost>
这里的任何潜在顾客都非常感激.
Any leads here is really appreciated.
推荐答案
您可以使用(代替RewriteRule ??
):
RewriteCond %{QUERY_STRING} (?:^|&)product=([^&]+) [NC]
RewriteRule ^/?loadproduct$ http://someotherdomain.com/%1? [R=301,L,NC]
这篇关于使用apache vhost配置重定向到新域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文