2012-08-09 42 views
0

嗨,我在codeigniter中有這樣的問題。我不能使用我的.css文件的樣式。但我知道這個過濾與我的觀點有關。 (螢火蟲)。這裏是我的鏈接,用於連接:在目錄/images/Enlighten.csscss in codeigniter

這裏

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

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無處不在當我使用從Enlighten.css文本樣式打印爲'??????????'

+0

對不起,我將文字標記爲代碼,因爲網站無法區分代碼。 – user1579200 2012-08-09 14:38:10

+0

無後顧之憂。我爲你解決了這個問題。對於代碼,您可以使用4個空格而不是' – Robert 2012-08-09 14:45:46

回答

3

如何使它像這樣的那麼複雜:

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

PS。 最好不要將您的CSS放置在images目錄中以防止混淆。 我總是用一個資產的文件夾,並在那裏組織一切:

/Assets 
    /css 
    /images 
    /js 
+0

我已將.css文件移至本地目錄。重寫鏈接和CSS規則的作品。但'?????'留下來。請參閱:http://s42.radikal.ru/i098/1208/f4/6c3d5990b784.jpg – user1579200 2012-08-09 15:03:53

+0

這似乎是一個編碼問題。你可以直接打開文件,如site.com/Enlighten.css? – Robert 2012-08-09 15:07:34

+0

是的,我可以。但是,如果它編碼,爲什麼所有其他文本通常是? – user1579200 2012-08-09 15:16:08

0

我建議使用以下.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> 
+0

恕我直言,它是不必要的因爲這些文件夾已經有了自己的'.htaccess'文件來阻止任何人訪問它們。 – Robert 2012-08-09 14:52:25

+0

@Robert爲什麼用空的'index.html'或'.htaccess'來扼殺文件系統? – 2012-08-09 14:55:20

+0

因此,您不必將所有內容都放在一個文件中,並在重命名文件夾時對其進行維護。 – Robert 2012-08-09 14:58:27

1

使用下面爲您htaccess文件代碼: -

<IfModule mod_rewrite.c> 
    RewriteEngine on 

    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php?/$1 [L] 
</IfModule> 
+0

我想你在這裏錯過了一條線Rakesh。這樣一切都會被重定向到index.php,包括CSS文件。 – Robert 2012-08-09 14:59:32

+0

我不這麼認爲,我試過這個,對我有用@Robert – 2012-08-10 10:34:24