简体   繁体   English

.htaccess - 如何在没有重定向的情况下发出异常

[英].htaccess - How to make an exception without redirection

So, I've a big problem with .htaccess. 所以,我对.htaccess有一个很大的问题。 All addresses are redirected to app/webroot. 所有地址都会重定向到app / webroot。 I'd like to make an exception without redirection for my file: cron-5min.php. 我想在没有重定向的情况下为我的文件做一个例外:cron-5min.php。

My part .htaccess: 我的部分.htaccess:

RewriteRule    ^cron-5min.php$ cron-5min.php
RewriteRule    ^$ app/webroot/    [L]
RewriteRule    (.*) app/webroot/$1 [L]

Unfortunately, when I type address.com/cron-5min.php it redirects me to file for path /app/webroot/cron-5min.php 不幸的是,当我输入address.com/cron-5min.php时,它会将我重定向到文件路径/app/webroot/cron-5min.php

I tried to add instruction RewriteRule ^cron-5min.php$ cron-5min.php in a variety of places in .htaccess, but nothing helped. 我试图在.htaccess中的各个地方添加指令RewriteRule ^ cron-5min.php $ cron-5min.php ,但没有任何帮助。

Thanks in advance! 提前致谢!

Your rewrite rule does not terminate the chain. 您的重写规则不会终止链。 Note your other two rewrite rules are appended with [L] (Last). 请注意,您的其他两个重写规则附加[L](最后)。 This indicates that no more rules should be processed when it matches. 这表示匹配时不应再处理任何规则。

You can also use the [END] flag, which is the same as [L], but no more rules will be processed from subsequent .htaccess files in this requrest. 您也可以使用[END]标志,该标志与[L]相同,但此请求中的后续.htaccess文件不再处理任何规则。

More info on both these flags and using flags are in the documentation: http://httpd.apache.org/docs/current/rewrite/flags.html 有关这些标志和使用标志的更多信息,请参阅文档: http//httpd.apache.org/docs/current/rewrite/flags.html

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

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