【发布时间】:2014-12-26 13:20:22
【问题描述】:
我试图找到一些答案,但它对我不起作用,所以我决定在这里问: 我是 codeigniter 的新手,看了一些教程后,我最终得到了这个 .htaccess 代码。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /myprojectname
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index.php|css|robots.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
我在本地主机上使用 xampp,我的问题是我无法在我的视图中加载我的 css
<link rel="stylesheet" href="css/metro-bootstrap.css">
实际上我在 RewriteCond $1 !^(index.php|css|robots.txt) 中包含 css
根是这样的
/
-application
-css
-js
-font
-system
-.htaccess
-index.php
【问题讨论】:
-
RewriteCond %{REQUEST_FILENAME} !-f应该已经确保不会重写现有文件。尝试删除排除 index.php、css 和 robots.txt 的行。 -
RewriteCond $1行需要删除。 -
事实上,
RewriteCond一点意义都没有…… -
真,删除
RewriteCond $1
标签: php html css .htaccess codeigniter