1

问题:

我如何 301 在 .htaccess 中重定向以下行:

Redirect 301   /reizen.asp?type=ind     http://domain.com/individuele-reizen
Redirect 301   /reis.asp?reisID=169     http://domain.com/individuele-reizen/oostenrijk/tirol-karinthie

我不断收到:错误:

The requested URL /reis.asp was not found on this server.

对堆栈溢出的搜索没有帮助。

4

1 回答 1

2

您无法使用Rediect指令匹配 QUERY_STRING。改用mod_rewrite

RewriteEngine On

RewriteCond %{QUERY_STRING} ^type=ind$ [NC]
RewriteRule ^/?reizen\.asp$ /individuele-reizen? [L,NC,R=301]

RewriteCond %{QUERY_STRING} ^reisID=169$ [NC]
RewriteRule ^/?reis\.asp$ /individuele-reizen/oostenrijk/tirol-karinthie? [L,NC,R=301]
于 2013-11-07T20:49:55.440 回答