我需要从 URL 进行重定向:
RewriteRule ^/cars/new/(.*)/(.*)/(.*).html$ /cars/new/$1/$2/ [R=301,L]
- 有用。
但是,类似的页面/cars/new/asd/qwe/zxc.html
也使用此规则进行重定向。
我只需要重定向 /cars/new/asd/ qwe / qwe .html之类的 URL
而不是 /cars/new/asd/ some_part / some_other_part .html
只有 /cars/new/asd/ some_part / some_part .html
请有任何建议!
更新:工作解决方案是
RewriteRule ^cars/new/(.*)/(.*)/\2.html$ /cars/new/$1/$2/ [R=301,L]