Php Codeigniter,windows,xampp,如何使用htaccess消除尾部斜杠?

Php Codeigniter,windows,xampp,如何使用htaccess消除尾部斜杠?,php,apache,.htaccess,codeigniter,Php,Apache,.htaccess,Codeigniter,所以我使用了一个.htaccess文件,我在这里搜索了它,我使用这个: RewriteEngine on RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA] 它根据需要删除index.php文件。我在codeigniter

所以我使用了一个.htaccess文件,我在这里搜索了它,我使用这个:

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
它根据需要删除index.php文件。我在codeigniter目录中有.htaccess文件。使用带有尾随斜杠的链接,网站显示良好:

http://localhost/codeigniter/home/
但是在home.php显示我的网站看起来好像没有链接到css文件之后,转到链接但没有斜杠。有什么建议吗

另外,在我的
config.php
文件中,我编辑了索引页:

$config['index_page'] = "";
如果这有什么区别的话

RewriteEngine on

# Next two lines get rid of trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]

RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
配置文件中的base_url也应为

$config['base_url'] = 'http://localhost/codeigniter/';
您应该从视图文件中发布代码,让我们确定发生了什么。我假设你使用的是某种相对路径。尝试使用以下方法:

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