In the following configuration is it possible to use a regular expression or any other method besides specifing each route to use controller thisisatest when URL is this-is-a-test/action? Would I have to build/extend my own Router class?
<?php
return array(
'_root_' => 'home/index', // The default route
'_404_' => 'error/404', // The main 404 route
//'hello(/:name)?' => array('welcome/hello', 'name' => 'hello')
);
/* end of config/routes.php */
The way I implemented this was to extend
\Fuel\Core\Routerusing the following. The router class works with a URI which has been passed through the methods insecurity.uri_filterfromconfig.phpso rather than modifying the router class methods I had my router extension add a callback to that array.You could just as easily add it straight to the configuration array in
app/config/config.phpby way of a closure or a call to a class method or a function.The downside of this is that both /path_to_controller/action and /path-to-controller/action will work and possibly cause some duplicate content SEO problems unless you indicate this to the search spider. This is assuming both paths are referenced somewhere i.e. a sitemap or an
<a href="">etc.