ABTanjir
ABTanjir

Reputation: 126

codigniter redirect() function not working properly

i have always used codigniter redirect function as

redirect('dashboard/index')

I have started a new project which is developed by someone else. In that project if I use

redirect('dashboard/index')

it's redirecting to base_url(); but if i use redirect('dashboard/index') everything is working fine. now the question is, how to solve this? Its hard to check all redirect function and base_url() everywhere.

edit: I have added url helper on every controller.

Upvotes: 1

Views: 71

Answers (2)

kalaivanan
kalaivanan

Reputation: 82

$redirect_url = base_url().'dashboard/index';
redirect($redirect_url);

Upvotes: 0

DFriend
DFriend

Reputation: 8964

It might be you have not supplied everything that $config['base_url'] needs. It should be a full URL complete with the protocol and ending in with a slash.

Try this.

$config['base_url'] = 'http://mywebsite.com/'; 

If you're using SSL then use https://mywebsite.com/

Upvotes: 1

Related Questions