【发布时间】:2017-06-28 00:30:49
【问题描述】:
我的应用程序文件夹结构是这样的
但我无法访问assets 文件夹中的内容。他们总是显示“404 page not found”。
例如,mysite.com/assets/frontend/page.css 显示错误。同时mysite.com/assets/css/bootstrap.min.css显示错误。
我的.htaccess 文件是
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
【问题讨论】:
-
您是否设置了基本 url 并自动加载 url 助手?
-
是的,我添加了基本 url 并自动加载 url 帮助程序。该代码在我的开发服务器(Easy PHP Dev Server)中运行良好,但在我的虚拟主机中运行良好。
-
因为您最有可能使用相对链接。当您使用 mod_rewrite 时,您将需要使用绝对链接、前面的正斜杠或头部中的基本标记。
标签: php .htaccess codeigniter http-status-code-404