Codeigniter htaccess相对于index.php的css路径

Codeigniter htaccess相对于index.php的css路径,codeigniter,.htaccess,Codeigniter,.htaccess,我在本地局域网上运行CodeIgniter 因为我有Wordpress,Drupal,。。。它们不应该冲突,我需要将它们作为子文件夹运行。例如: http://192.168.1.101/CodeIgniter/ 我的css位于: http://192.168.1.101/CodeIgniter/css/mystyle.css 在我的PHP中,样式是: <?='<link href="css/mystyle.css" rel="stylesheet" type="text/css

我在本地局域网上运行
CodeIgniter

因为我有Wordpress,Drupal,。。。它们不应该冲突,我需要将它们作为子文件夹运行。例如:

http://192.168.1.101/CodeIgniter/
我的css位于:

http://192.168.1.101/CodeIgniter/css/mystyle.css
在我的PHP中,样式是:

<?='<link href="css/mystyle.css" rel="stylesheet" type="text/css" />'?>
我的浏览器以相对的方式查找样式

http://192.168.1.101/CodeIgniter/users/css/mystyle.css
路径中有额外的用户

我希望所有CSS都能根据以下内容进行调整:

192.168.1.101/CodeIgniter/
这是
192.168.1.101/CodeIgniter/.htaccess
的内容:

RewriteEngine on
#RewriteBase /
RewriteCond $1 !^(index\.php|image|css|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
如何修复它

感谢Codeigniter提供了有助于处理URL的。 在application/config/Autoload.php中自动加载url帮助程序

$autoload['helper'] = array('url');
现在
echo base_url()
返回配置文件中指定的站点基URL

现在包括类似css的

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

虽然这种方法非常有效,但有另一种方法可以解决此问题,只需插入
true即可。我以前也这么做过,但我正在寻找一种摆脱绝对url的方法,使我的代码看起来像普通网站。但似乎没有办法。
<link href="<?php echo base_url('css/mystyle.css');?>" rel="stylesheet" type="text/css" />