2012-08-09 3 views
0

안녕하세요, 저는 codeigniter에서 이와 같은 문제가 있습니다. 내 .css 파일의 스타일을 사용할 수 없습니다. 그러나 나는이 물질이 나의 견해와 관련되어 있음을 안다. (방화범). 나는 내 실수는이 파일에 있다고 생각css in codeigniter

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] 

(내가 처리 해달라고 : 여기

디렉토리 /images/Enlighten.css에서

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

CSS 파일 내 htaccess로 파일 : 여기에 연결하기위한 내 링크입니다. 이 파일의 내용은 다음과 같습니다.

PS Enlighten.css 텍스트 스타일의 스타일을 '??????????'로 사용하는 경우

+0

죄송합니다. 사이트의 코드가 텍스트와 다른 코드이기 때문에 텍스트를 코드로 표시했습니다. – user1579200

+0

걱정할 필요가 없습니다. 나는 당신을 위해 그것을 고쳤다. 코드의 경우 ' – Robert

답변

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 
+0

대신 4 칸을 사용할 수 있습니다 .css 파일을 로컬 디렉토리로 옮겼습니다. 링크를 다시 작성하면 CSS 규칙이 작동합니다. 그러나 '?????' 머물렀다. 참조 : http://s42.radikal.ru/i098/1208/f4/6c3d5990b784.jpg – user1579200

+0

인코딩 문제 인 것 같습니다. site.com/Enlighten.css와 같은 파일을 직접 열 수 있습니까? – Robert

+0

예, 할 수 있습니다. 그러나 인코딩하는 경우 다른 텍스트가 모두 정상적으로 표시되는 이유는 무엇입니까? – user1579200

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

는 이럴 그것은 restrics에 unneccesary입니다 폴더에는 이미 다른 사람이 액세스 할 수 없도록하는 자체 .htaccess 파일이 있으므로 여기에 액세스하십시오. – Robert

+0

@Robert 빈'index.html' 또는'.htaccess'와 같은 불필요한 파일들로 파일 시스템을 질식시키는 이유는 무엇입니까? –

+0

이므로 모든 파일을 하나의 파일에 저장하고 폴더 이름을 변경할 때 유지 관리 할 필요가 없습니다. – Robert

1

사용하여 htaccess로 파일의 코드를 다음 -

<IfModule mod_rewrite.c> 
    RewriteEngine on 

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

여기 Rakesh 행이 누락 된 것 같아요. 이렇게하면 CSS 파일을 포함하여 모든 것이 index.php로 리디렉션됩니다. – Robert

+0

나는 그렇게 생각하지 않는다, 나는 이것을 시험해 보았다. 그리고 그것은 나를 위해 일한다 @ 로버트 –