Wordpress .htaccess 301仅重定向1个文件夹

Wordpress .htaccess 301仅重定向1个文件夹,wordpress,.htaccess,Wordpress,.htaccess,我在WordPress网站上工作 我想301重定向所有这些链接 example.com/a>example.com/b example.com/a/level1/level2>example.com/b/level1/level2 example.com/a/level1/level2/?productid=123>example.com/b/level1/level2/?productid=123 但是,我不想影响example.com/c、example.com/d、example.com/

我在WordPress网站上工作

我想301重定向所有这些链接

example.com/a>example.com/b

example.com/a/level1/level2>example.com/b/level1/level2

example.com/a/level1/level2/?productid=123>example.com/b/level1/level2/?productid=123

但是,我不想影响example.com/c、example.com/d、example.com/e,等等


如何将301将所有a流量重定向到b?

只需将此重定向规则放置在
重写引擎下方的
行:

RewriteEngine ^a(/.*)?$ /b$1 [L,NC,NE,R=301]
查询字符串将自动转发到新URL