Can anyone tell me why my redirect helper does not work the way I'd expect it to?
I'm trying to redirect to the index method of my main controller, but it takes me www.example.com/index/provider1/
when it should route to www.example.com/provider1
. Does this make sense to anyone? I have index page in config set to blank, although I don't think that it is the issue.
Does anyone have advice on how to fix this issue?
Controller:
if($provider == '') {
redirect('/index/provider1/', 'location');
}
.htaccess:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^(index\.php|files|images|js|css|robots\.txt|favicon\.ico)
RewriteCond %{HTTP_HOST} ^example.com/ttnf/
RewriteRule (.*) http://www.example.com/ttnf/$1 [R=301,L]
RewriteBase /ttnf/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
php_flag display_errors On
This statement resides in the URL helper which is loaded in the following way:
$this->load->helper('url');
The redirect function loads a local URI specified in the first parameter of the function call and built using the options specified in your config file.
The second parameter allows the developer to use different HTTP commands to perform the redirect "location" or "refresh".
According to the Code Igniter documentation: "Location is faster, but on Windows servers it can sometimes be a problem."
Example:
if ($user_logged_in === FALSE)
{
redirect('/account/login', 'refresh');
}