When I use header('Location: index') I get "localhost/pos/index", when I use redirect('index') I get "localhost/pos/localhost/pos/index" instead. I'm on Windows 10 using XAMPP. "localhost/pos" is the root of my application.
I tried using 'refresh' and 'location' to no avail. I tried adding the controller to the URI (so redirect('main/index') instead), I tried a slash at the beginning of the URI - every time, redirect() worked in this weird way I pointed out earlier. When I tried copying the header() code from redirect() body, it actually worked as it was supposed to...
redirect('index'); // Does the weird repeated URL
header('Location: index'); // Works fine
header('Location: '.$uri, TRUE, $code); // Works fine, even though it's redirect()'s body when $metod == 'location'
redirect('index'):
- expected: http://localhost/pos/index
- result: http://localhost/pos/localhost/pos/index