链接样式和脚本问题与htaccess文件

时间:2014-07-17 21:17:12

标签: regex apache .htaccess mod-rewrite

的.htaccess

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

的index.php

<link href="http://example.com/views/cp/css/style.css" />

由于.htaccess重写规则而未读取的样式更改它。 我怎么能用相同的.htaccess文件呢?

1 个答案:

答案 0 :(得分:1)

请避免为真实文件和目录重写它:

# If the request is not for a valid directory
RewriteCond %{REQUEST_FILENAME} !-d
# If the request is not for a valid file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]