本文介绍了301重定向与复杂的目录正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的文件夹重定向伟大的工程@ anubhava的解决方案。 301从一个目录重定向到另一个
I am using @anubhava's solution for folder redirect which works great. 301 redirect from one directory to another
我意识到,我还需要有一个301重定向以下
I realised that I also need to have a 301 redirect for the following
重定向
1) www.example/directory1/dirA/ 2) www.example/directory1/dirB/
重定向到
1) www.example/directory2/new-path-dirA/ 2) www.example/directory2/new-path-dirB/
编辑:我有很多这样的重定向(约40),想知道是否有办法有1重写规则 - 而不是单独的规则
I have a lot of these redirects (about 40) and was wondering if there is way to have 1 Rewrite rule - instead of separate rules?
谢谢!
推荐答案您可以添加这些新的规则:
You can add these new rules:
RewriteRule ^directory1/([^/]+)/(.*)$ /directory2/new-path-$1/$2 [NC,L,NE,R=301]更多推荐
301重定向与复杂的目录正则表达式
发布评论