如何解决Codeigniter WWW根
| 我想在根目录添加一个名为html的文件夹。在这个文件夹中,我将得到图像,js,css ect。我在根目录中使用.htaccess进行了以下操作:<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ html/ [L]
RewriteRule (.*) html/$1 [L]
</IfModule>
我也已经将index.php从根目录复制到html路径。在html / .htaccess文件中,我具有:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>
同样在index.php文件中,我将路径更改为:
$system_path = \'../system\';
$application_folder = \'../application\';
结果带有来自codeigniter的404错误页面。
解决方法
使用URL帮助器将始终解决此问题,请确保您的js和图像位于根目录中。
例如
<?php $this->load->helper(\'url\');?>
<link href=\"<?php echo site_url(\'style.css\')?>\" rel=\"stylesheet\" type=\"text/css\" />
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。