I need some help with redirection.
I want to redirect a url as shown in the address bar as below:
http://cricruns.com/venue/india/M.A.-Chidambaram
To a redirected url as below:
http://cricruns.com/index.php/venue/stadium?name=M.A.-开发者_开发知识库Chidambaram&tournament=World-Cup-2011
How can I do this?
Thanks in advance
Have you not tried the CodeIgniter User Guide?
- http://codeigniter.com/user_guide/helpers/url_helper.html
redirect()
Does a "header redirect" to the URI specified. If you specify the full site URL that link will be build, but for local links simply providing the URI segments to the controller you want to direct to will create the link. The function will build the URL based on your config file values.
The optional second parameter allows you to choose between the "location" method (default) or the "refresh" method. Location is faster, but on Windows servers it can sometimes be a problem. The optional third parameter allows you to send a specific HTTP Response Code - this could be used for example to create 301 redirects for search engine purposes. The default Response Code is 302. The third parameter is only available with 'location' redirects, and not 'refresh'.
Example:
if ($logged_in == FALSE)
{
redirect('/login/form/', 'refresh');
}
// with 301 redirect
redirect('/article/13', 'location', 301);
精彩评论