I want to allow dashes in the URI, so I must manually add a route for each URL that I want.
Example:
http://www.abc.com/growing-seeds/
is $route[‘growing-seeds’] = “growingseeds”;
My goal is to set up a regular expression to do this automatically because setting
up a route for every possible page is not an option.
This works for a path that only contains 1 dash.
Example:
http://www.abc.com/growing-seeds/
http://www.abc.com/deep-roots/
$route[’([A-Za-z0-9]+)-([A-Za-z0-9]+)’] = strtolower(”$1$3”);
My problem:
I want to be able to allow any number of dashes.
Example:
http://www.abc.com/growing-seeds-from-dirt/
$route[‘growing-seeds-from-dirt’] = “growingseedsfromdirt”;
How do I set this up automatically?
I’ve tried this, but it doesn’t seem to work:
$route[’([^/]+)’] = str_replace(’-’, ‘’, “$1”);
Any suggestions?
