.htaccess匹配完全字符串

时间:2017-07-16 10:13:40

标签: string .htaccess parameters match

我尝试将匹配查询字符串重定向到以下网址

/shop.php?arttyp=Indianerflöten/basiskategorie/indianerfloeten-high-spirits

当条件设置为

RewriteCond %{QUERY_STRING} ^arttyp=Indianerflöten$

没有重定向。但是

##This works but not good
RewriteCond %{QUERY_STRING} ^arttyp=.*$
RewriteRule  ^(.*)$ /basiskategorie/indianerfloeten-high-spirits [NC,R=301,L]

如何将完全查询字符串与htaccess匹配

1 个答案:

答案 0 :(得分:0)

这条规则适用于我:

RewriteCond %{QUERY_STRING} ^arttyp=Indianerflöten$
RewriteRule  ^shop\.php$ /basiskategorie/indianerfloeten-high-spirits? [NC,R=301,L]

确保目标末尾有?以从目标中删除现有查询字符串。

相关问题