codeigniter中的资产

Fre*_*efl 3 php codeigniter

我刚开始使用codeigniter并想在我的视图中包含一些外部CSS.这是我的目录结构:

application
   ....
system
   ....
assets
    css
        style.css
Run Code Online (Sandbox Code Playgroud)

我使用这个html代码链接文件:(使用example.com作为示例,lol)

<link rel="Stylesheet" type="text/css" href="http://example.com/assets/css/style.css"/>
Run Code Online (Sandbox Code Playgroud)

这是我的.htaccess文件:

RewriteEngine on

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

现在,我的问题是它返回404错误.如果您需要更多信息,请说

提前致谢!

sim*_*nom 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]
Run Code Online (Sandbox Code Playgroud)

给那个打击,看看你如何继续.