从在.htaccess重写规则排除文件重写、规则、文件、htaccess

2023-09-02 11:40:18 作者:北冥の邪霖

我修改使用一个相当复杂的.htaccess文件实现自定义的MVC型框架,以便所有的网址被重定向到index.php一个现有的网站?[一些参数]或404页。我想添加AJAX支持网站的一个有限的区域内使用 xajax的,并执行我需要的地方在根两个文件它们由重写规则忽略。我怎么做?

I'm modifying an existing website that uses a fairly complex .htaccess file to implement a custom MVC type framework so all urls are redirected to index.php?[some parameters] or a 404 page. I'd like to add ajax support to a limited area of the site using XAJAX, and to implement that I need to place two files in the root which are ignored by the rewrite rules. How do I do that?

推荐答案

怎么样的身份对你的规则上方改写为最后一个标志规则?

How about identity rewriting rule with "last" flag on the top of your rules?

例如,要排除/a-file-outside-of-rewriting.html从目前的一套规则,以下配置可能会有所帮助:

For example, to exclude "/a-file-outside-of-rewriting.html" from current set of rules, the following configuration might help:

# http://~/outside-of-rewriting.html will be rewritten to itself (i.e., unmodified).
# then no more rules will be applied (because it has "last" flag.)
RewriteRule ^/a-file-outside-of-rewriting.html$ $0 [L]

RewriteRule ^/any/other/rules(/.*) $1
RewriteRule ^/already/exist(/.*) $1
# ...