how to redirect from CI index.php to folder/index.php? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: how to redirect from CI index.php to folder/index.php? (/showthread.php?tid=49342) Pages:
1
2
|
how to redirect from CI index.php to folder/index.php? - El Forum - 02-16-2012 [eluser]qwertyjjj[/eluser] I just loaded codeigniter. How can I make a redirect in the index.php file to redirect all traffic to catalog/index.php? how to redirect from CI index.php to folder/index.php? - El Forum - 02-16-2012 [eluser]amalik[/eluser] Hey, If you want to redirect your users directly to catalog class you can change it is your config/routes.php file by editing $route['default_controller'] = "catalog"; and that will load the index function from the catalog class. If you want to actually create a redirect because of any other reason you can use redirect('catalog'); and that will load your index function from your catalog class. hope it helps. amalik how to redirect from CI index.php to folder/index.php? - El Forum - 02-16-2012 [eluser]qwertyjjj[/eluser] [quote author="amalik" date="1329386464"]Hey, If you want to redirect your users directly to catalog class you can change it is your config/routes.php file by editing $route['default_controller'] = "catalog"; and that will load the index function from the catalog class. If you want to actually create a redirect because of any other reason you can use redirect('catalog'); and that will load your index function from your catalog class. hope it helps. amalik[/quote] Basically, I have OSCommerce installed. OSCOmmerce runs by loading the index.php file under the catalog folder. I installed COdeIgniter because I want to use it alongside OSCOmmerce for some new functionality and jQuery. ie there is no catalog class in OSCommerce. how to redirect from CI index.php to folder/index.php? - El Forum - 02-16-2012 [eluser]InsiteFX[/eluser] Code: $route['catalog'] = 'catalog/index'; In Contoller Code: redirect('catalog/index', 'refresh'); how to redirect from CI index.php to folder/index.php? - El Forum - 02-16-2012 [eluser]porquero[/eluser] You can use Multiple applications too: http://ellislab.com/codeigniter/user-guide/general/managing_apps.html how to redirect from CI index.php to folder/index.php? - El Forum - 02-16-2012 [eluser]qwertyjjj[/eluser] [quote author="InsiteFX" date="1329392957"] Code: $route['catalog'] = 'catalog/index'; In Contoller Code: redirect('catalog/index', 'refresh'); Sorry, I'm a bit lost on that (I've read through tutorials but still a long way to go with learning) The controller folder only has welcome.php and index.html. Do I need to make an index.php controller and then an index.php view? Where do I put $route['catalog'] = 'catalog/index'; is it application/config? I changed welcome.php in the controllers to: public function index() { redirect('catalog/index', 'refresh'); //$this->load->view('welcome_message'); } but now I just get a blank page when going to http://localhost ...or am I supposed to put the entire OSCommerce application, stylesheets, and folders into the application folder? how to redirect from CI index.php to folder/index.php? - El Forum - 02-16-2012 [eluser]porquero[/eluser] Well, I see that you need known more CI. I recomend you read the tutorial. It help you to understand CI. http://ellislab.com/codeigniter/user-guide/tutorial/index.html how to redirect from CI index.php to folder/index.php? - El Forum - 02-16-2012 [eluser]qwertyjjj[/eluser] [quote author="porquero" date="1329408020"]Well, I see that you need known more CI. I recomend you read the tutorial. It help you to understand CI. http://ellislab.com/codeigniter/user-guide/tutorial/index.html[/quote] I've read it but that doesn;t mean pratical experience of. Is there a section on redirecting? There's not really anything in the manual covering integration with existing sites. The default controller is welcome.php so in the index function I put: redirect('/catalog/', 'refresh'); However, that just shows a blank page at http://localhost It should show localhost/catalog/index.php and that index.php page is not MVC it is OSCommerce code. how to redirect from CI index.php to folder/index.php? - El Forum - 02-16-2012 [eluser]porquero[/eluser] Are you sure? Read Tutorial - Static pages: Routing http://ellislab.com/codeigniter/user-guide/tutorial/static_pages.html how to redirect from CI index.php to folder/index.php? - El Forum - 02-16-2012 [eluser]qwertyjjj[/eluser] [quote author="porquero" date="1329408480"]Are you sure? Read Tutorial - Static pages: Routing http://ellislab.com/codeigniter/user-guide/tutorial/static_pages.html[/quote] But all that means that I should set a controller called index.php with a function that has a redirect. I then have a view called index.php but it essentially does nothing. However, when I go to localhost/index.php I get a blank page ? Should I be setting this in the routes.php file: $route['default_controller'] = 'pages/view'; but make it $route['default_controller'] = 'index.php'; Can the default controller not be a php page, does it have to be /somefolder/index ? |