简体   繁体   English

如果当前规则适用,则阻止.htaccess处理其他规则

[英]Prevent .htaccess to process further rules if current rule is applicable

I am applying .htaccess to application coded in CodeIgnier. 我将.htaccess应用于CodeIgnier中编码的应用程序。 By default, in order to remove index.php from the url you need to place one rule in htaccess file which is as follows. 默认情况下,要从url中删除index.php,您需要在htaccess文件中放置一个规则,如下所示。

RewriteRule ^(.*)$ index.php?url=$1 [PT,L]

What basically above rule means is that redirect all the requests to the domain to index.php file. 基本上,上述规则意味着将所有请求重定向到该域到index.php文件。

What i want is, i want to add some more rules like follows 我想要的是,我想添加一些如下的规则

Redirect 301 /index.php?user=kids /kids

I am not sure how to do that because .htaccess processes the first rule mentioned above and does not redirect the /index.php?user=kids to /kids 我不确定该怎么做,因为.htaccess会处理上述第一条规则,并且不会将/index.php?user=kids重定向到/ kids

Only solution i can think of is that if there is some way to prevent .htaccess file to further process the rules if the current one matches. 我能想到的唯一解决方案是,如果当前规则匹配,是否有某种方法可以防止.htaccess文件进一步处理规则。

Thanks In Advance 提前致谢

The [L] flag does exactly this. [L]标志正是这样做的。 You could add 您可以添加

RewriteRule ^index.php\?user=kids$ /kids [R=301,L]

and it would work. 它会工作。

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

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