summaryrefslogtreecommitdiffstats
path: root/user_guide/general/routing.html
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-08-26 03:15:06 +0200
committeradmin <devnull@localhost>2006-08-26 03:15:06 +0200
commitd4e95072203a5cf4f1d50d16fe3e490f275a4307 (patch)
treeedc5497d9a2caa4b4659bff16c2f5068a5012086 /user_guide/general/routing.html
parenta634e56d86b965df334e4a431fb0586565ade7a6 (diff)
Diffstat (limited to 'user_guide/general/routing.html')
-rw-r--r--user_guide/general/routing.html29
1 files changed, 26 insertions, 3 deletions
diff --git a/user_guide/general/routing.html b/user_guide/general/routing.html
index c6e8bd9cf..977698b9f 100644
--- a/user_guide/general/routing.html
+++ b/user_guide/general/routing.html
@@ -85,8 +85,13 @@ To overcome this, Code Igniter allows you to remap the URI handler.</p>
<h2>Setting your own routing rules</h2>
-<p>Routing rules are defined in your <var>application/config/routes.php</var> file. In it you'll see an array called <dfn>$route</dfn>, that
-you can use to specify your own routing criteria. A typical route might look something like this:</p>
+<p>Routing rules are defined in your <var>application/config/routes.php</var> file. In it you'll see an array called <dfn>$route</dfn> that
+permits you to specify your own routing criteria. Routes can either be specified using <dfn>wildcards</dfn> or <dfn>Regular Expressions</dnf>
+
+
+<h2>Wildcards</h2>
+
+<p>A typical wildcard route might look something like this:</p>
<code>$route['product/:num'] = "catalog/product_lookup";</code>
@@ -125,8 +130,21 @@ Higher routes will always take precedence over lower ones.</p>
<p class="important"><strong>Important:</strong> Do not use leading/trailing slashes.</p>
+<h2>Regular Expressions</h2>
+
+<p>If you prefer you can use regular expressions to define your routing rules. Any valid regular expression is allowed, as are back-references.</p>
+
+<p class="important"><strong>Note:</strong>&nbsp; If you use back-references you must use the dollar syntax rather then the double backslash syntax.</p>
+
+<p>A typical RegEx route might look something like this:</p>
+
+<code>$route['products\/([a-z]+)\/(\d+)'] = "$1/id_$2";</code>
-<h2>Reserved Route</h2>
+<p>In the above example, a URI similar to <dfn>products/shirts/123</dfn> would instead call the <dfn>shirts</dfn> controller class and the <dfn>id_123</dfn> function.</p>
+
+<p>You can also mix and match wildcards with regular expressions.</p>
+
+<h2>Reserved Routes</h2>
<p>There are two reserved routes:</p>
@@ -144,6 +162,11 @@ Please read the <a href="scaffolding.html">Scaffolding</a> page for details.</p>
+
+
+
+
+
</div>
<!-- END CONTENT -->