htaccess重新排序子路径顺序

时间:2014-10-21 14:19:24

标签: php .htaccess mod-rewrite

我有一个包含类别和品牌列表的网站。这些作为过滤器,当我使用一个过滤器时一切都很好。当我将这两个网址合并为www.domain.com/productlisting/category/cat1/brand/brand1.htmlwww.domain.com/productlisting/brand/brand1/category/cat1.html时。这是重复的内容 - 为了消除这种情况,我希望只剩下一种可能性(www.domain.com/productlisting/brand/brand1/category/cat1.html)。网页生成两种变体,因此我想在.htaccess文件中添加重写规则,但它不起作用。 也许有人可以给我一个暗示:

 Options +FollowSymlinks
 RewriteEngine On
 RewriteRule /productlisting/category/([a-zA-Z0-9-_]+)/brand/([a-zA-Z0-9-_]+)\.html  /productlisting/brand/$2/category/$1.html  [L]

1 个答案:

答案 0 :(得分:0)

适用于

  

RedirectMatch 301 /produktuebersicht/category/([^/]+)/brand/([^/]+).html/produktuebersicht/brand/$2/category/$1.html

- )

相关问题