codeigniter中的资产 [英] Assets in codeigniter

查看:82
本文介绍了codeigniter中的资产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've just started using codeigniter and wanted to include some external css in my view. This is my directory structure:

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

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

I'm linking the file using this html code: (Used example.com as an example, lol)

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

这是我的.htaccess文件:

Here is my .htaccess file:

RewriteEngine on

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

现在,我的问题是, 404错误。

Now, my problem is that it returns an 404 error. Say if you need more info.

提前感谢!

推荐答案

我发现CI .htaccess规则有一些限制,必须添加所有不同的文件夹所需。因此,我使用以下:

I've found the CI .htaccess rules some what restrictive having to add all different folders required. I therefore use the following:

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



一个bash,看看你怎么上。

Give that a bash and see how you get on.

这篇关于codeigniter中的资产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆