IonLogic IonLogic - 1 year ago 131
PHP Question

CodeIgniter redirects replacing localhost URL with [::1]

I'm currently writing an application where I extend the CI_Controller class and check if a user is logged in, if they aren't I redirect them to the login page.

However, I'm finding that whenever I do this, my the URL it redirects to, changes from localhost/~username/ to [::1]/~username/

The system I'm using is OS X Yosemite and using safari

I've searched everywhere, but with no luck. Any ideas as to the cause of this and how to solve it?

Answer Source

May be your base_url is empty.

Setup the base_url

In config/config.php

$config['base_url'] = 'http://localhost/project_name';
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download