[英]How to exclude certain URI from Apache mod_rewrite (Apache 2.2) in .htaccess
I have .htaccess file that is successfully redirecting requests based on detecting incoming URI and prefixing with "index.php" for Codeigniter, like so: 我有.htaccess文件,它根据检测到的URI成功地重定向请求,并为Codeigniter加上“ index.php”前缀,如下所示:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
I'm now just building custom Apache modules, and I need to exclude any URI request to that module. 现在,我仅在构建自定义Apache模块,并且需要排除对该模块的任何URI请求。 My httpd.conf will show something like: 我的httpd.conf将显示如下内容:
LoadModule my_module modules/libmod_my.so
<Location /mymodule>
SetHandler mod_my-handler
</Location>
This should work fine, but the .htaccess rule is catching any request to /mymodule and turning it into /index.php/mymodule 这应该可以正常工作,但是.htaccess规则正在捕获对/ mymodule的任何请求并将其转换为/index.php/mymodule
The .htaccess rules do successfully bypass any request to a valid file (graphics, css, js, etc.). .htaccess规则确实成功绕过了对有效文件(图形,css,js等)的任何请求。
What is the best way to amend the .htaccess to also have it bypass any request like this: 修改.htaccess使其绕过任何请求的最佳方法是什么:
http://localhost/mymodule/function HTTP://本地主机/ MyModule的/功能
so that any request to /mymodule is excluded from being modified? 这样对/ mymodule的任何请求都不会被修改?
Thanks in advance for any suggestions. 在此先感谢您的任何建议。
To exclude anything starting with mymodule
, add another condition in front of the RewriteRule
要排除以mymodule
开头的任何内容,请在RewriteRule
前面添加另一个条件
RewriteCond %{REQUEST_URI} !^/mymodule
Another approach (although I haven't tried this yet) could be to switch off mod_rewrite
inside the Location
directive 另一种方法(尽管我还没有尝试过)可能是在Location
指令中关闭mod_rewrite
<Location /mymodule>
SetHandler mod_my-handler
RewriteEngine off
</Location>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.