0

嗨,我在 codeigniter 中有这样的问题。我无法使用 .css 文件的样式。但我知道这个过滤器与我的观点有关。(萤火虫)。这是我的连接链接:

`<link rel="stylesheet" href="images/Enlighten.css" type="text/css" />`

目录中的css文件/images/Enlighten.css

这是我的 htaccess 文件:

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|template|robots\.txt|public|)
RewriteCond %{REQUEST_URI} !\.(css¦js¦jpg¦gif)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L,QSA]

我认为我的错误在这个文件中。(我不处理这个文件:(()

PS Everywhere 当我使用来自 Enlighten.css 的样式时,文本打印为“??????????”

4

3 回答 3

3

像这样让它变得不那么复杂怎么样:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

附言。最好不要将 CSS 放在 images 目录中以防止混淆。我总是使用资产文件夹并在那里组织所有内容:

/Assets
  /css
  /images
  /js
于 2012-08-09T14:41:52.597 回答
1

use following code for your htaccess file :-

<IfModule mod_rewrite.c>
    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
于 2012-08-09T14:53:46.070 回答
0

I recommend to use the following .htaccess:

AddDefaultCharset UTF-8

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #Removes access to the system folder by users.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Prevents user access to the application folder
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule> 
于 2012-08-09T14:47:19.023 回答