2017-05-29 58 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] 
相關問題