简体   繁体   English

.htaccess只在某个文件夹中重定向

[英].htaccess redirect only within certain folder

I have a few folders set up and use a basic rewrite for PHP extensions (where the URL does not display the .php) (eg /public_html/folderA | /public_html/folderB). 我有一些文件夹设置并使用PHP扩展的基本重写(其中URL不显示.php)(例如/ public_html / folderA | / public_html / folderB)。

I've now set up some new folders that I do NOT want to have this redirect apply to (/public_html/folderC), but I can't figure out how to make the redirect apply exclusively to certain paths? 我现在已经设置了一些新文件夹,我不希望将此重定向应用于(/ public_html / folderC),但我无法弄清楚如何使重定向专门应用于某些路径?

You can add a .htaccess file in public_html/folderC with: 您可以在public_html / folderC中添加.htaccess文件:

RewriteEngine Off

You can also write exclusions (before other rules) 你也可以写排除(在其他规则之前)

RewriteRule ^(public_html\/folderC)($|/) - [L]

Notice the [L], that will tell the rewrite engine not to look for any other rules. 注意[L],它将告诉重写引擎不要寻找任何其他规则。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM