【发布时间】:2016-10-04 19:38:05
【问题描述】:
我在域名后多了一个斜杠,例如http://localhost/folder//project/list_all
以下是用于从 url 中删除 index.php 的 htaccess 代码 我正在使用 codeigniter
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
}
【问题讨论】:
-
RewriteRule ^index.php/(.*)$只会影响以/index.php/开头的 URL,您的 .htaccess 位于哪里?
标签: php .htaccess codeigniter