Welcome Guest, Not a member yet? Register   Sign In
separate routes configuration for site and admin?
#1

[eluser]Zeeshan Rasool[/eluser]
Is there any way to define url rewriting for both site and admin separately?
bcoz there is a command $route['(.*)/blog'] = 'site/blog';
that is for site but when i m in admin this command also executes.
any idea?
#2

[eluser]Phil Sturgeon[/eluser]
I flip mine around:

Code:
$route['admin/([a-zA-Z_-]+)/(:any)'] = "$1/admin/$2";
$route['admin/([a-zA-Z_-]+)/(:any)/(:any)'] = "$1/admin/$2/$3";
$route['admin/login'] = "admin/login";
$route['admin/logout'] = "admin/logout";
$route['admin/([a-zA-Z_-]+)'] = "$1/admin/index";
$route['admin'] = "admin";

That can be tidied down im sure, it's just something that I set up and seems to work fine for me. Each of my modules has its own rules on how to handle many of the common URL's but this basically means that:

Quote:admin/blog/create

is routed to:

Quote:blog/admin/create

which is mapped to:

Quote:Module: blog
Controller: Admin
Method: create

Then underneath those you can put in your rule:

Code:
$route['(.*)/blog'] = 'site/blog';




Theme © iAndrew 2016 - Forum software by © MyBB