问题:
我如何在.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.
搜索堆栈溢出没有帮助。
答案 0 :(得分: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]