用于排除单个文件或文件类型的 Apache ReWrite 规则?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1984025/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 18:32:45  来源:igfitidea点击:

Apache ReWrite rule to exclude an individual file or type of file?

apachemod-rewriterewrite

提问by roacha

Can you help me with an Apache rule to exclude a particular file name or type of file? Here are my current rules:

你能帮我制定一个 Apache 规则来排除特定的文件名或文件类型吗?这是我目前的规则:

RewriteRule ^/(?:blog)/ - [L]
RewriteRule ^crossdomain\.xml$ - [L]  (Based on first response)
RewriteRule ^/(.*_css.*\.css.*) / [QSA,L]
RewriteRule ^/(.*_js.*\.js.*) / [QSA,L]
RewriteRule ^/(.*_swf.*\.swf.*) / [QSA,L]
RewriteRule ^/(.*_img.*\.[jpg|JPG|jpeg|JPEG|gif|GIF|bmp|BMP|png|PNG].*) / [QSA,L]
RewriteRule ^/(.*)$ /index.php?url= [QSA,L]
</VirtualHost>

I am trying to exclude my Flash crossdomain.xml file from getting rewritten. Thanks!

我试图从重写我的 Flash crossdomain.xml 文件中排除。谢谢!

回答by Gumbo

Just put this rule on top of yours:

只需将此规则放在您的之上:

RewriteRule ^/crossdomain\.xml$ - [L]