css - 如何忽略使用 .htaccess 重写 css 文件

标签 css apache .htaccess mod-rewrite

我创建了 .htaccess 文件:

RewriteRule     ^([a-zA-Z]{0,2})/(.*)/(.*)$     index.php?lang=$1&ctrl=$2&method=$3 [L]
RewriteRule     ^([a-zA-Z]{0,2})/(.*)$          index.php?lang=$1&ctrl=$2 [L]
RewriteRule     ^(.*)/(.*)$                     index.php?ctrl=$1&method=$2 [L]

RewriteCond     %{QUERY_STRING}                 !ctrl
RewriteRule     ^(.*)/?$                        index.php?ctrl=$1 [L]

我需要它来忽略重写包含的 css 文件。

谢谢你的回答:)

最佳答案

保持你的规则是这样的:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule ^([a-zA-Z]{0,2})/([^/]+)/([^/]+)/?$ index.php?lang=$1&ctrl=$2&method=$3 [L,QSA]
RewriteRule ^([a-zA-Z]{0,2})/(.*)$ index.php?lang=$1&ctrl=$2 [L,QSA]
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?ctrl=$1&method=$2 [L,QSA]

RewriteCond %{QUERY_STRING} !ctrl
RewriteRule ^([^/]+)/?$ index.php?ctrl=$1 [L,QSA]

关于css - 如何忽略使用 .htaccess 重写 css 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25081752/

相关文章:

css - 将按钮与基础 CSS 中的文本输入对齐

asp.net - 使用旧的 ASP.NET 2.0,但使用新的浏览器 (IE 7) ... 我应该使用绝对定位或流布局或 CSS 还是什么? :-)

css - 滚动到底部时,模态底部的填充会弄乱固定标题

django - Apache/Windows/mod_wsgi 上的多个 django 站点 - win32 的问题

regex - 带有嵌套 .htaccess 文件的 mod_rewrite

css - 在网页上使用喜欢/分享按钮 - 格式化?

apache - 记录错误日志的URL

apache - 为什么http ://localhost redirect to my default virtual host once I setup virtual hosts in Apache?

php - 将 http 流量重定向到 https 并避免混合内容警告

javascript - HTML 默认 href 值