A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2009 yearRedirect with CodeIgniter - page 1
User InfoPosts
Redirect with CodeIgniter#1
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.mysite.com/index/provider1/ when it should route to www.mysite.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? Thanks in advance!


if($provider == (() {
redirect((/index/provider1/(, (location();


RewriteEngine on

RewriteCond %{REQUEST_URI} !^(index\.php|files|images|js|css|robots\.txt|favicon\.ico)

RewriteCond %{HTTP_HOST} ^mysite.com/ttnf/
RewriteRule (.*) http://www.mysite.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

posted date: 2009-04-06 17:39:00

Re: Redirect with CodeIgniter#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2009-04-06 17:39:01

Re: Redirect with CodeIgniter#3
DUH.... i'm an idiot today, i wasn't sending it to my controller (which is main.php) instead it was as if i was trying to load a controller named index. so sorry.

posted date: 2009-04-06 18:34:00

Re: Redirect with CodeIgniter#4
redirect()URL HelperThe redirect statement in code igniter sends the user to the specified web page using a redirect header statement.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();}

posted date: 2009-04-07 03:27:00

Re: Redirect with CodeIgniter#5
This is a very useful CodeIgniter question. The interaction between Apache rules and CI routes needs more examples on the internet.

posted date: 2014-03-05 02:44:00

Re: Redirect with CodeIgniter#6
+1 and thank you ,it saved my time

posted date: 2014-06-04 02:34:00

Re: Redirect with CodeIgniter#7
If your directory structure is like this,site application controller folder_1 first_controller.php second_controller.php folder_2 first_controller.php second_controller.phpAnd when you are going to redirect it in same controller in which you are working then just write the following code. $this->load->helper((url(); if ($some_value === FALSE/TRUE) //You may give 0/1 as well,its up to your logic { redirect((same_controller/method(, (refresh(); }And if you want to redirect to another control then use the following code.$this->load->helper((url();if ($some_value === FALSE/TRUE) //You may give 0/1 as well,its up to your logic{ redirect((folder_name/any_controller_name/method(, (refresh();}

posted date: 2014-12-20 01:45:00

select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.