有没有更有效的方法来编写这些重定向?
RewriteRule ^directory/subdir/1990/010190/(.*)$ directory/editorials/$1 [L,R=301]
RewriteRule ^directory/subdir/1990/020190/(.*)$ directory/editorials/$1 [L,R=301]
RewriteRule ^directory/subdir/1990/030190/(.*)$ directory/editorials/$1 [L,R=301]
RewriteRule ^directory/subdir/1990/040190/(.*)$ directory/editorials/$1 [L,R=301]
RewriteRule ^directory/subdir/1990/050190/(.*)$ directory/editorials/$1 [L,R=301]
RewriteRule ^directory/subdir/1990/060190/(.*)$ directory/editorials/$1 [L,R=301]
似乎我需要一个通配符用于/1990/
能够做到这一点会大大减少重定向的次数,使其更易于管理。任何帮助或提示赞赏!
答案 0 :(得分:2)
您可以对所有这些规则使用单一规则:
RewriteRule ^directory/subdir/1990/0[1-6]0190/(.*)$ directory/editorials/$1 [L,R=301]