添加外部css文件时获取内部服务器错误500

时间:2016-05-21 07:43:46

标签: php twitter-bootstrap .htaccess codeigniter

我正在使用codeigniter和bootstrap 3.Problem是当我尝试在我的项目中添加boostrap css文件时我得到错误。当我从下面的代码中删除链接标记时,错误得到修复。我得到了这个错误以及我如何解决这个问题?请帮帮我

<!DOCTYPE html>
<html>
  <head>
      <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
      <meta content="utf-8" http-equiv="encoding">
      <link rel='stylesheet' type='text/css' href='<?php echo base_url("assets/css/bootstrap.min.css"); ?>' >


  </head>
<body>

<h1>this is index</h1>
</body>

</html>

在我的config.php文件中,我添加了基本网址,如下所示

$config['base_url'] = 'http://localhost/mycodeigniter/ci/index.php';

并从以下

中删除了index.php
$config['index_page'] = '';

在根目录下的htaccess文件中我粘贴了以下代码以删除index.php表单url

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

1 个答案:

答案 0 :(得分:0)

从您的index.php删除$config['base_url'],因为您的重写规则会从网址中删除index.php。所以在基本网址中仍然没有任何意义。
我猜你的问题是因为你没有启用 mod_rewrite 。 重写规则需要Apache模块 mod_rewrite