2011-10-25 6 views
0

내 코드 기자 응용 프로그램의 루트에 /css이라는 디렉토리가 있습니다. style.css 파일이 있습니다. href="<?php echo base_url();?>css/styles.css"을 사용하여 파일에 링크하면 내 CSS가 실행되지 않고 html로 나타납니다.codeigniter css htaccess, 파일을 읽을 수 없습니다.

이렇게하기 위해 .htaccess 파일을 수정해야하는 그물을 읽었습니다. 많은 기사에서 방법을 설명했지만 그 방법은 저에게 맞지 않았습니다.

어떻게 htaccess 코드를 사용하여 다음 폴더/images,/js,/css를 읽을 수 있습니까?

나는 그것이 작동하고이 시도의 index.php에게

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/

    #Removes access to the system folder by users. 
    #Additionally this will allow you to create a System.php controller, 
    #previously this would not have been possible. 
    #'system' can be replaced if you have renamed your system folder. 
    RewriteCond %{REQUEST_URI} ^system.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

    #When your application folder isn't in the system folder 
    #This snippet prevents user access to the application folder 
    #Submitted by: Fabdrol 
    #Rename 'application' to your applications folder name. 
    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> 
    # If we don't have mod_rewrite installed, all 404's 
    # can be sent to index.php, and everything works as normal. 
    # Submitted by: ElliotHaughin 

    ErrorDocument 404 /index.php 
</IfModule> 
+0

음, 어쩌면 당신을 따르지 않아요. 이것은 예상되는 동작입니다. 스타일 시트에 직접 링크하면 스타일 시트가 나타납니다. 그 밖의 무엇을하고 싶니? –

+0

스타일 시트를 볼 수 있지만 어떤 이유로 codeigniter가 CSS로 그것을 읽고 html을 맨 위에 추가하지 않습니다. – hairynuggets

+0

의 뜻은 다음과 같습니다. #blockthing {bunchof : css;}? –

답변

1

을 제거 codeigniters에게 기본 htaccess로 코드를 사용하고 있습니다.

<link rel="stylesheet" href="<?php echo base_url();?>css/style.css" type="text/css" /> 
관련 문제