为什么我在.htaccess中使用mod_rewrite我的css文件无法使用?

时间:2014-09-21 18:30:21

标签: php .htaccess rewrite

我有这个网址:

http://domain.com/index.php?type=item&id=656&title=mytitle

Kow我想在.htaccess中将此网址重写为:

http://domain.com/item/656/mytitle

我在.htaccess中使用了这个ruls:

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /index.php?type=$1&id=$2&title=$3 [L]

虽然css中的jsindex.php个文件无法正常工作,但已有效

我的css文件链接

<link rel="stylesheet" type="text/css" href="file/css/style.css" />

1 个答案:

答案 0 :(得分:1)

了解RewriteCond

# If the request is not for a valid file
RewriteCond %{REQUEST_FILENAME} !-f
# Then...
RewriteRule ...

# If the uri not starts with ...
RewriteCond %{REQUEST_URI} !^/file/css
# Then...
RewriteRule ...