Php .htaccess重定向除一个子目录外的所有子目录

Php .htaccess重定向除一个子目录外的所有子目录,php,apache,.htaccess,mod-rewrite,redirect,Php,Apache,.htaccess,Mod Rewrite,Redirect,目前在my.htaccess中,我有以下代码将所有请求重定向到example.com/folder/,并将所有子目录重定向到example.com/land RewriteEngine on RewriteRule ^folder/(.+) page [L,R=301] Redirect /folder https://example.com/land/ example.com/folder/重定向到example.com/land-是 example.com/folder/sub-a/重定向

目前在my.htaccess中,我有以下代码将所有请求重定向到example.com/folder/,并将所有子目录重定向到example.com/land

RewriteEngine on
RewriteRule ^folder/(.+) page [L,R=301]
Redirect /folder https://example.com/land/
example.com/folder/重定向到example.com/land-是

example.com/folder/sub-a/重定向到example.com/land-是

现在我希望example.com/folder/sub-b/和example.com/folder/sub-b/page不要重定向

我怎样才能做到这一点?我尝试过搜索和阅读,但没有找到适合我的情况的解决方案。谢谢你的帮助。

只需重定向所有


然后将其重定向到其原始位置

这个规则在重写规则^folder/+page[L,R=301]时做了什么?老实说,我不是100%确定,也不是非常熟悉.htaccess。我在一篇教程中找到了它。我想我需要它,因为我没有将example.com/folder/sub-a重定向到example.com/land/sub-a,而是将example.com/folder/sub-a重定向到example.com/land,但我还是不能100%确定。嗯,不需要重定向的子目录的url中会有额外的参数,所以我认为这不起作用。