CodeIgniter Forums
routes - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: routes (/thread-26149.html)



routes - El Forum - 01-07-2010

[eluser]Fr3aked0ut[/eluser]
Hi.
How can I make route that I don't HAVE to use it?

I mean, let's say I have this url:
http://test.com/some.html,0

",0" is the page (pagination class).

I want to able the user to go in with out the ",0" (on the first page only). How do I do that?

This is my route:
$route['cat/(:num)-(:any).html,(:num)'] = 'pages/cat/$1/$2/$3';

I want to make the ",(:num)" optional.

Thanks in advance.


routes - El Forum - 01-08-2010

[eluser]Sean Gates[/eluser]
Try changing it to a regular expression:

Code:
$route[‘cat/(\d+)-(.*?).html(,\d+)?’] = ‘pages/cat/$1/$2/$3’;

I just checked what I wrote and it should work for you. Let me know!