2017-02-07 7 views
0

私はこのヘッダを私のheader.phpに持っています。私はここで正しい回答をすべてstackoverflowで見つけましたが、まだそれは私の仕事をしませんでした。誰もがplsを助けることができます。事前にありがとう:)cssファイルがcodeigniterに読み込まれませんか?

私のフォルダ構造は次のとおりです。

メインフォルダ: ci_attl - アプリケーション - CSS - style.cssに

<link href="<?php echo base_url();?>application/css/style.css" rel="stylesheet"> - not working 

<link href="<?php echo base_url();?>/css/style.css" rel="stylesheet"> - not working 

<link href="<?php echo base_url();?>../css/style.css" rel="stylesheet"> - not working 

私autoload.php

$autoload['helper'] = array('form','url', 'html'); 

私の.htaccess

<IfModule mod_rewrite.c> 

    RewriteEngine On 
    RewriteBase /ci_attl/ 

    RewriteCond %{REQUEST_URI} ^system.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

    RewriteCond %{REQUEST_URI} ^application.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

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

</IfModule> 

<IfModule !mod_rewrite.c> 
    ErrorDocument 404 /index.php 
</IfModule> 

私のconfig.php

$config['base_url'] = ''; 
$config['index_page'] = ''; 

私のコンソールエラー

Failed to load resource: the server responded with a status of 403 (Forbidden) 
http://[::1]/ci_attl/application/css/style.css 
+0

誰でも助けてくれますか?よろしくお願いします。 –

答えて

1

あなたはあなたの資産の全てのための特別なフォルダを作成する必要があります。

アプリケーションフォルダに入れると、CIの.htaccessルールのために403エラーが発生します。

あなたのルート構造にフォルダを作成することをお勧めします。たとえば、 'assets'とし、すべてのCSS/jsをそこに保存してください。

だからあなたはまた、あなたが正しいの.htaccessを持っていることを

Options +FollowSymLinks -MultiViews 
RewriteEngine on 
RewriteBase /ci_attl/ 
RewriteCond $1 !^(index\.php|assets|images|robots\.txt) 
RewriteRule ^(.*)$ index.php/$1 [L] 

は試してみて、私に知らせて確認してください。このパス

http://[::1]/ci_attl/assets/css/style.css 

になってしまいます。

+0

owありがとうございますpr0metheus :) –

+0

今私はヘッダフッタファイルを分けてあります:) –

関連する問題