Welcome Guest, Not a member yet? Register   Sign In
Routes: Regexpt exclusion
#1

[eluser]IkoTikashi[/eluser]
Hello forum,

I'm trying to setup routes on my CI-project (a little photoblog). I've succeeded in setting up this route:

Code:
$route['([a-z0-9]+)/([a-zA-Z]+)'] = "photo/index/$1/$2";

which makes my photo-urls look like "http://myhost/CATEGORYNAME/PHOTONAME".

Now I wanted to create some administration-pages in a subfolder called "admin". For those to work I need to exclude "admin" from my route. I tried

Code:
$route['(^admin/)([a-z0-9]+)/([a-zA-Z]+)'] = "photo/index/$1/$2";
, but this gives me a "404 Page Not Found" on my photo-detail-pages (admin-pages do work however). I guess it's my complete noobness with regular expressions - can anybody push me in the right direction please?
#2

[eluser]IkoTikashi[/eluser]
Nevermind,

I got it solved by adding another route, so my routes now look like this:

Code:
$route['admin/([a-zA-Z]+)'] = "admin/$1";

$route['([a-z0-9]+)/([a-zA-Z]+)'] = "photo/index/$1/$2";




Theme © iAndrew 2016 - Forum software by © MyBB