重定向查询字符串部分,如果它在扩展名

时间:2015-09-08 17:18:06

标签: php .htaccess

我在zen cart框架中使用终极seo url。我有两种类型的URL结构需要重定向。

1)http://www.naturaflowers.com/anemones/wedding-anemone-flowers.html?somestring

http://www.naturaflowers.com/anemones/wedding-anemone-flowers.html

2)(***在这种情况下,仅参数/?page = 1时)如下所示

http://www.naturaflowers.com/wholesale-flowers.html?page=1

http://www.naturaflowers.com/wholesale-flowers.html

无法弄清楚。任何帮助将不胜感激。请!!

1 个答案:

答案 0 :(得分:2)

尝试:

RewriteEngine On

RewriteCond %{THE_REQUEST} \?somestring
RewriteRule ^(anemones/wedding-anemone-flowers.html)$ /$1? [L,R]

RewriteCond %{THE_REQUEST} \?page=1($|&)
RewriteRUle ^(wholesale-flowers.html)$ /$1? [L,R]