Ian Livingstone
Ian Livingstone

Reputation: 261

CodeIgniter variable URL Routing

So basically what I want to do is have my routes.php setup so that if the route is defined then it uses that routing rule else it does something like this:

domain.com/VAR/controller/method/(vars) to domain.com/controller/method/var/(vars)

I think it can be done with a regex, but my regex-fu is very weak. Any tips would be greatly appreciated.

Upvotes: 1

Views: 2747

Answers (1)

user290102
user290102

Reputation:

$route['domain.com/(:any)/controller/method/(:any)'] = 'domain.com/controller/method/$1/$2';

That should do the trick.

Upvotes: 2

Related Questions