问题
I am using @anubhava's solution for folder redirect which works great. 301 redirect from one directory to another
I realised that I also need to have a 301 redirect for the following
REDIRECT FROM
1) www.example.com/directory1/dirA/
2) www.example.com/directory1/dirB/
REDIRECT TO
1) www.example.com/directory2/new-path-dirA/
2) www.example.com/directory2/new-path-dirB/
EDIT: 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?
Thanks!
回答1:
You can add these new rules:
RewriteRule ^directory1/([^/]+)/(.*)$ /directory2/new-path-$1/$2 [NC,L,NE,R=301]
来源:https://stackoverflow.com/questions/26249516/301-redirect-with-complex-directory-regex