CodeIgniter Forums
put checks in routes file ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: put checks in routes file ? (/thread-24175.html)



put checks in routes file ? - El Forum - 11-02-2009

[eluser]Zeeshan Rasool[/eluser]
hi every one, can any one tell me that how can we put checks in routes file to control both site and admin as well?
I am using one route file but if there is a check for site it can effect to admin so i have to write a separate rewrite condition for admin in against of each rewrite condition of site.
So i need a check so that its easy to determine conditions for both side separately

very thanks!


put checks in routes file ? - El Forum - 11-02-2009

[eluser]Phil Sturgeon[/eluser]
You want different routes in the same file, based on which site it is?

routes.php

Code:
if($_SERVER['HTTP_HOST'] == 'foo.com')
{
   // routes
}else == 'bar.com')
{
   // routes
}

or use a switch, you get the idea though.


put checks in routes file ? - El Forum - 11-02-2009

[eluser]Zeeshan Rasool[/eluser]
yeah thanks, Phil it really nice idea.
i was thinking that may be there would be some other solution Smile but its good


put checks in routes file ? - El Forum - 11-02-2009

[eluser]Phil Sturgeon[/eluser]
You can do it there or in the .htaccess which is probably a better solution. You said "routes" so I went with it.


put checks in routes file ? - El Forum - 11-02-2009

[eluser]Zeeshan Rasool[/eluser]
no no its ok, very thanks for this ;-)