我的 .htaccess 文件出错:/
我正在开发一个小型网站,我想使用 .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]
如果您能帮助我找到解决方案,我将非常高兴。 :/ 提前致谢。
I'm developing a small website and i want to use a .htaccess file to make my URIs more search engine friendly. My problem is, that my CSS files can't be find. I use the following .htaccess rules:
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]
Maybe many of you know this code. My website stucture is the following:
/
-css
-layout.css
-images
-image.jpg
-js
-jquery.js
-includes
-controller
-model
-view
-.htaccess
-index.php
When I load my website, the css parts are not loading. My template looks like this:
<!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>
I tried different ways. Shouldn't the following code stop the module to rewrite the request for css files:
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]
It would be really glad, if you could help me, to find a solution. :/ Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论