Codeigniter无法加载错误404

时间:2017-04-03 17:59:29

标签: php apache codeigniter

无法使用codeigniter加载css文件获取错误404。

这是我的链接标记

<head>

    <link rel="stylesheet" type="text/css" href= "<?php echo base_url();?>css/style.css">

<head>

服务器文件夹

-httpdocs
---application
---cgi-bin
---css --> style.css
---system
---user_guide

错误

GET http://31.8.7.79/css/style.css 

我不确定它是否有问题但是由于某些原因,codeigniter使用此http地址http://31.8.7.79/而不是http://www.someurl.com可能是因为Apache服务器?

尝试在没有Apache服务器的情况下使用不同的服务器做同样的事情并且它完美地运行

2 个答案:

答案 0 :(得分:3)

在文件application/config/config.php中设置base_url项目如下,看看是否有帮助

$config['base_url']  = 'http://www.someurl.com/';

答案 1 :(得分:0)

<强> CONFIG.PHP

$config['base_url']  = 'http://www.someurl.com/';

.htaccess

RewriteEngine on

RewriteCond $1 !^(index\.php|css|(.*)\.css|(.*)\.js|(.*)\.jpg|(.*)\.jpeg|(.*)\.png|(.*)\.bmp|(.*)\.gif|(.*)\.doc|(.*)\.shtml|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ ./index.php/$1 [L]