我在 www.mydomain.com/test 的 Godaddy 子域上安装了 CI 我的主页加载以及指向我的 /news 页面的链接
我遇到的问题是我无法加载任何图像或加载我的 CSS 文件。我通过以下方式从我的头文件中调用我的 CSS:
<link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>inc/css/base.css" media="all"/>
我通过以下方式调用我的标题图片:
<img src="images/logo.png">
当我右键单击 X 图像应该在的位置时,然后选择在新选项卡中打开,这样我就可以看到它指向的 url... 看起来不错。 http://mydomain.com/test/images/logo.png
我回应了我的 site_url 和 base_url,它们似乎配置正确,指向: http ://www.mydomain.com/test/
我的结构是:/test
1 索引.php
2 .htaccess
3 /系统
4 /应用
- /控制器
- /图片
- /inc
--- /css
--- /js - /意见
在查看了 stackoverflow 问题之后...我将位于 www.mydomain.com/test 文件夹中的 .htaccess 粘贴到 CI 中:
RewriteEngine On
RewriteBase /test
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /test/index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
我的 config.php 是:
$config['base_url'] = 'http://www.mydomain.com/test/';
$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";