[英]Extra slash after domain required after removing 'index.php' from Codeigniter
[英]extra slash after removing index.php using htaccess
我在域名之后得到一个额外的斜杠,例如http:// localhost / folder // project / list_all
以下是用于从我使用codeigniter的url中删除index.php的htaccess代码
RewriteEngine On
RewriteRule ^index.php/(.*)$ /$1 [R=302,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1 [L]
在上面的代码之后添加了额外的斜杠。
我该如何解决?
//full code
controller/project
public function list_all() {
//code....
)
//----------------------------
routes.php
$route['default_controller'] = 'home';
//--------------------------------
config.php
$config['base_url'] = 'http://localhost:8080/folder';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
//--------------------------------------------------
//controller home.php
public function home() {
//call model load data
//call view
}
你的代码似乎是两次的东西,试试这个:
<IfModule mod_rewrite.c>
RewriteEngine on
# Send request via index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
您的htaccess必须位于索引文件所在的位置
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.