我要重定向URL:
prolist.php?id=1297&lang=en
对此:
details.php?id=1297
但是id不想重定向URL末尾没有“ lang = en”参数的其他URL。
答案 0 :(得分:0)
因此,您想为重定向规则实现与查询字符串匹配精确模式的条件:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^id=(\d+)&lang=en$
RewriteRule ^/?prolist\.php$ /details.php?id=%1 [QSD,R=301]
也许您还想实现内部重写规则:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^id=(\d+)&lang=en$
RewriteRule ^/?prolist\.php$ /details.php?id=%1 [QSD,L,R=301]
RewriteCond %{QUERY_STRING} ^id=(\d+)$
RewriteRule ^/?details\.php$ /prolist.php?id=%1&lang=en [L]