【发布时间】:2015-06-05 15:09:08
【问题描述】:
我正在使用 Codeigniter Framework 开发一个应用程序。 我想从 url 中删除 index.php ,所以我激活了 mod_rewrite ,并修改了 .htacces 文件, index.php 已被删除,应用程序运行完美,但 css 文件和 js 文件不想加载。
要加载一个 css 文件,我使用这一行
<link <?php echo 'href="' . base_url() . 'application/views' . '/css/bootstrap.min.css" rel="stylesheet"' ?>>
但它说
You don't have permission to access /kingplast/application/views/css/bootstrap.min.css on this server.
有关更多信息,我将提供我的 000-default.conf 文件和 .htacces 文件
000-default.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory /var/www/html>
AllowOverride All
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
.htacces
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /kingplast/
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>
顺便说一句,我尝试将文件 chmod 为 777,但没有成功。 有关更多信息,我正在运行 Ubuntu 15.04
请帮帮我
【问题讨论】:
-
您无法通过应用程序文件夹访问css和js 在主目录中创建资产文件夹最佳选项stackoverflow.com/questions/30410940/…
-
我可以从应用程序文件夹访问css和js,实际上它正在工作
-
不推荐,虽然我被告知
标签: php apache codeigniter mod-rewrite