.htaccess错误404 codeigniter + bootstrap

时间:2013-12-17 02:04:40

标签: php codeigniter twitter-bootstrap configuration url-routing

为什么我的bootstrap.css链接链接返回错误? bootstrap的链接变为:

http://localhost/ciproj/localhost/ciproj/assets/css/bootstrap.css

但我正在使用像这样的代码

<link rel="stylesheet" text="text/css" href="<?php base_url(); ?>assests/css/bootstrap.css />

我的config.php设置为:

$config['base_url'] = 'localhost/ciproj';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

我的.htaccess是

<IfModule mod_rewrite.cs>
      RewriteEngine On
      RewriteCond $1 !^(index\.php|images|Scripts|css|robots\.txt)
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php/$1 [L]
 </IfModule>

我的目录结构就像这样

-ciproj
   -application
     -system
     -index.php
     -assets
            -css
                -bootstrap.css
            -js
     -.htaccess

1 个答案:

答案 0 :(得分:1)

尝试从

更改
$config['base_url'] = 'localhost/ciproj';

$config['base_url'] = 'http://localhost/ciproj';

更新

<IfModule mod_rewrite.cs> 
    RewriteEngine On 
    RewriteCond $1 !^(index\.php|images|assets|Scripts|css|robots\.txt) 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule>