简体   繁体   English

Codeigniter重定向使URL翻倍

[英]Codeigniter redirect doubles URL

I'm using codeigniter in localhost and I'm trying to redirect my controller to another controller, so what I basically do is: 我在本地主机中使用codeigniter,并且尝试将我的控制器重定向到另一个控制器,所以我基本上要做的是:

        redirect('/account/index');

However, it does not go to the URL, instead it goes here: 但是,它不会转到URL,而是转到此处:

http://localhost/ticketsystem/index.php/logincheck/localhost/ticketsystem/index.php/account/index

It doubles my address. 它使我的地址翻了一番。 Do I need to set something in my config.php? 我需要在config.php中设置一些内容吗? My setup in my config.php is 我在config.php中的设置是

$config['base_url'] = 'localhost/ticketsystem';

$config['index_page'] = 'index.php';

$config['uri_protocol'] = 'AUTO';

Do I need to change something there, or am I doing something else that makes my redirect cause problems? 我是否需要在此处进行某些更改,或者是否正在做其他导致重定向的问题?

The base_url behaving like relative path, change into complete url, and also add '/' in last base_url行为类似于相对路径,更改为完整的url,并在最后添加'/'

$config['base_url'] = 'localhost/ticketsystem';

To

$config['base_url'] = 'http://localhost/ticketsystem/';

your base url should be looks like 您的基本网址应如下所示

$config['base_url'] = 'http://localhost/ticketsystem/';

use redirect like :- 使用重定向:

redirect('account/index', 'refresh');

refresh will use meta refresh and should quick redirect 刷新将使用元刷新,并应快速重定向

尝试删除帐户前的“ /”!

redirect('account/index');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM