301 使用目录通配符重定向 htaccess



有没有更有效的方法来编写这些重定向?

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/子目录的通配符

能够做到这一点将大大减少我拥有的重定向数量,使其更易于管理。任何帮助或提示表示赞赏!

您可以对所有这些规则使用单个规则:

RewriteRule ^directory/subdir/1990/0[1-6]0190/(.*)$ directory/editorials/$1 [L,R=301]

最新更新