【发布时间】:2012-05-15 13:15:14
【问题描述】:
我在 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/
我的结构是: /测试
1 索引.php
2 .htaccess
3 /系统
4 /应用程序
- /控制器
- /图片
- /公司
--- /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";
【问题讨论】:
-
如果您在浏览器中手动输入“mydomain.com/test/images/logo.png” - 图片会加载吗?
标签: css image codeigniter hyperlink subdirectory