marchemike
marchemike

Reputation: 3277

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:

        redirect('/account/index');

However, it does not go to the URL, instead it goes here:

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? My setup in my config.php is

$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?

Upvotes: 0

Views: 1411

Answers (3)

Rakesh Sharma
Rakesh Sharma

Reputation: 13728

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

Upvotes: 1

sunny
sunny

Reputation: 1166

try removing the '/' before account!

redirect('account/index');

Upvotes: 0

Girish
Girish

Reputation: 12127

The base_url behaving like relative path, change into complete url, and also add '/' in last

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

To

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

Upvotes: 3

Related Questions