in codeigniter you can use wildcard to reroute.
i never heard the word wildcards before.
is this a set of rules you can use like regexp?
cause in codeigniter documentation they just gave some examples eg.
$route['product/(:num)'] = "catalog/product_lookup_by_id/$1";
is there a list/reference with all the available wildcard expressions you can use?
A Wildcard route has a path consisting of two asterisks (**). It matches every URL, the router will select this route if it can't match a route earlier in the configuration. A Wildcard Route can navigate to a custom component or can redirect to an existing route.
Routing matches the URL to the pre-defined routes. If no CodeIgniter Route match is found then, CodeIgniter throws a page not found an exception. CI Routing is responsible for responding to URL requests. Routing matches the URL to the pre-defined routes.
Routing rules are defined in your application/config/routes. php file. In it you'll see an array called $route that permits you to specify your own routing criteria. Routes can either be specified using wildcards or Regular Expressions.
Defining a Default ControllerCodeIgniter can be told to load a default controller when a URI is not present, as will be the case when only your site root URL is requested. To specify a default controller, open your application/config/routes. php file and set this variable: $route['default_controller'] = ' Blog ';
You can match literal values or you can use two wildcard types:
:num
:any
:num will match a segment containing only numbers.
:any will match a segment containing any character.
Or you can use your custom regex, example:
$route['products/([a-z]+)/(\d+)'] = "$1/id_$2";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With