Help with route regex if specific words are present

#1
[eluser]CroNiX[/eluser]
I have a few custom pages like
site.com/about
site.com/help
site.com/privacy

Currently they are going to their own controllers. I want to create a generic controller that will handle these specific pages but leave the rest of the routing alone.

I think this is close but can't quite get it. I'm a regex idiot...and I admit it.
Code:
$route['((?about|help|home|privacy|tou).*)'] = 'custom_page/$1';

Thanks for any help.

#2
[eluser]Cristian Gilè[/eluser]
You could put a _remap() in your base controller.

Cristian Gilè

#3
[eluser]CroNiX[/eluser]
Thanks. I'm not using a single base controller. If the url is a certain word, I want to map it to a specific controller and leave the rest alone.

Basically a one liner for:
$route['about'] = 'custom_page/about';
$route['home'] = 'custom_page/home';
$route['help'] = 'custom_page/help';
...

$route['(.*)/communities/(.*)'] = 'locations/view_community/$1/$2';
...
more routes...

#4
[eluser]Imran Tariq[/eluser]
Instead of using this
[quote author="CroNiX" date="1294967168"]
$route['about'] = 'custom_page/about';
$route['home'] = 'custom_page/home';
$route['help'] = 'custom_page/help';[/quote]
You should try this
Quote:$route['about|home|help'] = 'custom_page/$1';


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.