0

我想将以下类型的文件夹重定向example.com/stores/something/title/example.com/stores/title/. 我做了以下重定向:

RedirectMatch 301 /stores/(.*)/(.*)/(.*) http://www.example.com/stores/$2/$3

它可以工作,但是我有一个问题:我不想重定向这些链接:

example.com/stores/title/page/2/

我的重定向将上述链接重定向到example.com/stores/2/. 所以我想重定向除了“页面”子文件夹之外的所有内容。

4

2 回答 2

0

您可以使用负前瞻来确保第三个参数不是“页面”

RedirectMatch 301 /stores/(.*)/(?!page)(.*)/(.*) http://www.example.com/stores/$2/$3
于 2013-01-01T18:26:34.830 回答
0
RewriteRule .*/page/.* - [L]

应该这样做。它应该出现在其他规则之上。

于 2013-01-01T15:22:24.097 回答