Redirect "/" to "/home"? - 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: Redirect "/" to "/home"? (/showthread.php?tid=14618) Pages:
1
2
|
Redirect "/" to "/home"? - El Forum - 01-08-2009 [eluser]kyleect[/eluser] I'm trying to figure out what to add to my htaccess to redirect "/" to "/home" but to complicate things, the app may not be in the root directory. It could be a sub directory, like this: http://localhost/app/ to http://localhost/app/home I have tried looking at mod_rewrite tutorials but still can't get it to work. This is what I've tried. RewriteRule ^/$ /home Which, does nothing. Please help! Redirect "/" to "/home"? - El Forum - 01-09-2009 [eluser]srisa[/eluser] You can set up "home" as your default controller and CI will redirect '/' to /home/index. Redirect "/" to "/home"? - El Forum - 01-10-2009 [eluser]kyleect[/eluser] home is my default now, and that works but I want an actual redirect. This would be similar to how some people redirect www.domain.com to just domain.com Redirect "/" to "/home"? - El Forum - 01-10-2009 [eluser]Unknown[/eluser] There is a redirect function in one of the CI helpers. Can't remember whcih, but it's there. Redirect "/" to "/home"? - El Forum - 01-10-2009 [eluser]Pascal Kriete[/eluser] It's in the url helper (which is a good one to autoload ). Edit: Re-reading your post, for anything outside CI you will need to use mod_rewrite of course. Redirect "/" to "/home"? - El Forum - 01-10-2009 [eluser]kyleect[/eluser] I know but I don't know the mod_rewrite to do it. Does anyone know the mod_rewrite to do this? Redirect "/" to "/home"? - El Forum - 01-10-2009 [eluser]darkhouse[/eluser] I don't know if this would work, and this might be a "hacky" solution, but what if you wrote a library like this: Code: class Home_redirect { and then autoloaded that library? Again, I didn't test it, but it might do what you need without using mod_rewrite. Redirect "/" to "/home"? - El Forum - 01-11-2009 [eluser]kyleect[/eluser] I would prefer to do this with mod_rewrite, keeping it as "clean" as possible. Redirect "/" to "/home"? - El Forum - 01-11-2009 [eluser]darkhouse[/eluser] I agree it's a dirty solution and htaccess is the way to go (if possible). I would use this as a last resort myself. Redirect "/" to "/home"? - El Forum - 01-11-2009 [eluser]garrettheel[/eluser] Code: RewriteEngine On |