From d4e95072203a5cf4f1d50d16fe3e490f275a4307 Mon Sep 17 00:00:00 2001
From: admin
Routing rules are defined in your application/config/routes.php file. In it you'll see an array called $route, that -you can use to specify your own routing criteria. A typical route might look something like this:
+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
+
+
+ A typical wildcard route might look something like this:Wildcards
+
+$route['product/:num'] = "catalog/product_lookup";
@@ -125,8 +130,21 @@ Higher routes will always take precedence over lower ones.
Important: Do not use leading/trailing slashes.
+If you prefer you can use regular expressions to define your routing rules. Any valid regular expression is allowed, as are back-references.
+ +Note: If you use back-references you must use the dollar syntax rather then the double backslash syntax.
+ +A typical RegEx route might look something like this:
+ +$route['products\/([a-z]+)\/(\d+)'] = "$1/id_$2";
-In the above example, a URI similar to products/shirts/123 would instead call the shirts controller class and the id_123 function.
+ +You can also mix and match wildcards with regular expressions.
+ +There are two reserved routes:
@@ -144,6 +162,11 @@ Please read the Scaffolding page for details. + + + + + -- cgit v1.2.3-24-g4f1b