我的.htaccess文件出错:/

时间:2012-02-17 22:01:32

标签: css .htaccess mod-rewrite

我正在开发一个小型网站,我想使用.htaccess文件来使我的URI更适合搜索引擎。我的问题是,我的CSS文件无法找到。我使用以下.htaccess规则:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteRule ^.*$ - [NC,L]

RewriteRule ^.*$ /index.php [NC,L]

也许很多人都知道这段代码。我的网站结构如下:

/
-css
 -layout.css
-images
 -image.jpg
-js
 -jquery.js
-includes
 -controller
 -model
 -view
-.htaccess
-index.php

当我加载我的网站时,css部分未加载。我的模板如下所示:

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <title><?php echo $this->title ? $this->title : 'MVC Beispiel'; ?></title>
        <link href="css/layout.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    $content
    </body>
</html>

我尝试了不同的方法。以下代码不应该停止模块重写css文件的请求:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} (\.css)$
RewriteRule ^.*$ - [NC,L]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteRule ^.*$ - [NC,L]

RewriteRule ^.*$ /index.php [NC,L]

如果能帮助我,找到解决方案真的很高兴。 :/提前谢谢。

0 个答案:

没有答案
相关问题