的.htaccess对特定文件类型 [英] .htaccess on specific filetypes

查看:136
本文介绍了的.htaccess对特定文件类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的htaccess的一些神奇的东西。它的工作原理非常好,但我不知道该怎么

I have some magic stuff in my htaccess. It works very well but I don't know how

RewriteRule ^[^_+/]. index.php

我觉得它说,所有的请求应该通过的index.php无论哪个目录的游客要求。到目前为止,一切都很好。不过图像,CSS文件,JS文件等应当然不会被解析的index.php文件。我可以排除上述规则的某些目录?像/ IMG,/ ​​css和/ JS

I think it says that all requests should go through index.php no matter which directory the visitor ask for. So far so good. However images, css files, js files etc should of course not be parsed in index.php. Can I exclude certain directories from the above rule? Like /img, /css and /js

其他建议?

在此先感谢

推荐答案

您可以通过使用简单的RewriteCond避免请求某些路径...

You can avoid requests to certain paths by using a simple RewriteCond...

RewriteCond ${REQUEST_URI} !^css
RewriteCond %{REQUEST_URI} !^img
RewriteCond %{REQUEST_URI} !^js
# or alternatively just
RewriteCond ${REQUEST_URI} !^(css|img|js)

这篇关于的.htaccess对特定文件类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆