2011-07-14 7 views
3

私はcodeigniterの使用を開始したばかりで、私のビューにはいくつかの外部CSSを含めたいと思っていました。ここで codeigniterのアセット

<link rel="Stylesheet" type="text/css" href="http://example.com/assets/css/style.css"/> 

が私の.htaccessファイルである(例としてexample.comを使用し、笑)::

application 
    .... 
system 
    .... 
assets 
    css 
     style.css 

私は、このhtmlコードを使用してファイルをリンクしています:これは私のディレクトリ構造である

RewriteEngine on 

RewriteCond $1 !^(index\.php|images|css|js|robots\.txt) 
RewriteRule ^(.*)$ index.php/$1 [L] 

私の問題は、404エラーを返すことです。もっと情報が必要だと言ってください。

ありがとうございます!

答えて

6

私は、CIの.htaccessルールが、必要なすべての異なるフォルダを追加することを制限するものを見つけました。したがって、私は次のものを使用します:

# 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] 

あなたはどのように乗っているかを見てください。

+0

WOW、ありがとう!それは素晴らしかった!ありがとうm8! – Fredefl

関連する問題