Welcome Guest, Not a member yet? Register   Sign In
URL Routing: With or without trailing slash
#1

[eluser]jonnyjon[/eluser]
Hi,
I have a route set up:

$route['directory/(:any)'] = "controller/function/$1";

The problem is that...
This works: http://example.com/directory/whatever
But this doesn't work: http://example.com/directory

I know I could add a second route:
$route['directory'] = "controller/function";

But is there a way to incorporate a reg ex to handle both cases in one statement?

This this (but this doesn't work):
$route['directory[\/*](:any)'] = "controller/function/$1";


Messages In This Thread
URL Routing: With or without trailing slash - by El Forum - 07-16-2008, 05:59 PM
URL Routing: With or without trailing slash - by El Forum - 07-16-2008, 07:01 PM
URL Routing: With or without trailing slash - by El Forum - 07-16-2008, 08:08 PM
URL Routing: With or without trailing slash - by El Forum - 07-17-2008, 12:07 AM
URL Routing: With or without trailing slash - by El Forum - 07-17-2008, 05:39 AM
URL Routing: With or without trailing slash - by El Forum - 07-17-2008, 07:45 AM
URL Routing: With or without trailing slash - by El Forum - 07-17-2008, 09:17 PM



Theme © iAndrew 2016 - Forum software by © MyBB