2017-05-29 61 views
0

我有一个不同的查询ID列表需要重定向到其他网站和页面。像:如何编写一个RewriteRule从特定的查询字符串重定向?

RewriteRule ^/index.php?id=1111$ http://newdomain.tld/site.html [R=301,L,NE] 
RewriteRule ^/index.php?id=2222$ http://nextdomain.tld/othersite.html [R=301,L,NE] 

但是这个例子不起作用,因为源包含查询字符串。我有点卡住了。希望解决办法很简单,但你能帮我吗?谢谢。

回答

1

对于查询字符串,你必须在条件下使用下面的规则,这是一个例子,我假设你可以使用下面创建多个优化规则。

RewriteCond %{QUERY_STRING} ^id=1111$ 
RewriteRule^http://newdomain.tld/site.html [R=301,L,NE] 
相关问题