【发布时间】:2011-11-28 18:28:21
【问题描述】:
我正在使用 CI 进行一些测试,并让它在一个文件夹中运行。以http://www.example.com/sub-folder/ 为例
我的目录结构是这样的(其中/是子文件夹/):
/
|-/系统
|-/应用程序
我有 Eclipse 作为我的 IDE,有 2 个项目,1 个用于系统,1 个用于应用程序,其中应用程序是我的项目,其中包含对系统的引用。
我的 .htaccess 文件阻止访问系统目录。我想将我的图像和 CSS 分别放入:application/resources/images 和 application/resources/css。我希望能够使用<link rel="stylesheet" href="/sub-folder/css/style.css" /> 但是,经过一段时间的测试和搜索,我无法从应用程序目录中加载 CSS 文件。
我需要在 .htaccess 中更改或添加什么才能执行此操作?
我的 .htaccess 的内容如下:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
### Canonicalize codeigniter URLs
# If your default controller is something other than
# "welcome" you should probably change this
RewriteRule ^(welcome(/index)?|index(\.php)?)/?$ / [L,R=301]
RewriteRule ^(.*)/index/?$ $1 [L,R=301]
# Removes trailing slashes (prevents SEO duplicate content issues)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]
# 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]
# 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]
【问题讨论】: