summaryrefslogtreecommitdiffstats
path: root/user_guide/general/routing.html
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2011-05-08 17:23:36 +0200
committerPhil Sturgeon <email@philsturgeon.co.uk>2011-05-08 17:23:36 +0200
commit0854d91fd2848266ec37a37c8a1ccfd13a8a4eda (patch)
tree1433f1db86920fae6e6286c6cc517ba64cda2aba /user_guide/general/routing.html
parent0cb8c59f91567af9aa6530f8764abafe1ae935c0 (diff)
parent3ef65bd7491f847fecdab1acc9687f0e90eee09b (diff)
Merged tip.
Diffstat (limited to 'user_guide/general/routing.html')
-rw-r--r--user_guide/general/routing.html19
1 files changed, 12 insertions, 7 deletions
diff --git a/user_guide/general/routing.html b/user_guide/general/routing.html
index 4413ef997..6f06ad64f 100644
--- a/user_guide/general/routing.html
+++ b/user_guide/general/routing.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.1</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.0.2</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -80,7 +80,7 @@ To overcome this, CodeIgniter 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
+<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</dfn></p>
@@ -90,7 +90,7 @@ permits you to specify your own routing criteria. Routes can either be specified
<code>$route['product/:num'] = "catalog/product_lookup";</code>
-<p>In a route, the array key contains the URI to be matched, while the array value contains the destination it should be re-routed to.
+<p>In a route, the array key contains the URI to be matched, while the array value contains the destination it should be re-routed to.
In the above example, if the literal word "product" is found in the first segment of the URL, and a number is found in the second segment,
the "catalog" class and the "product_lookup" method are instead used.</p>
@@ -111,10 +111,10 @@ Higher routes will always take precedence over lower ones.</p>
<p>A URL containing the word "journals" in the first segment will be remapped to the "blogs" class.</p>
<code>$route['blog/joe'] = "blogs/users/34";</code>
-<p>A URL containing the segments blog/joe will be remapped to the "blogs" class and the "users" method. The ID will be set to "34".</p>
+<p>A URL containing the segments blog/joe will be remapped to the "blogs" class and the "users" method. The ID will be set to "34".</p>
<code>$route['product/(:any)'] = "catalog/product_lookup";</code>
-<p>A URL with "product" as the first segment, and anything in the second will be remapped to the "catalog" class and the "product_lookup" method.</p>
+<p>A URL with "product" as the first segment, and anything in the second will be remapped to the "catalog" class and the "product_lookup" method.</p>
<code>$route['product/(:num)'] = "catalog/product_lookup_by_id/$1";</code>
<p>A URL with "product" as the first segment, and a number in the second will be remapped to the "catalog" class and the "product_lookup_by_id" method passing in the match as a variable to the function.</p>
@@ -123,7 +123,7 @@ Higher routes will always take precedence over lower ones.</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>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 than the double backslash syntax.</p>
@@ -142,9 +142,14 @@ Higher routes will always take precedence over lower ones.</p>
<code>$route['default_controller'] = 'welcome';</code>
<p>This route indicates which controller class should be loaded if the URI contains no data, which will be the case
-when people load your root URL. In the above example, the "welcome" class would be loaded. You
+when people load your root URL. In the above example, the "welcome" class would be loaded. You
are encouraged to always have a default route otherwise a 404 page will appear by default.</p>
+<code>$route['404_override'] = '';</code>
+
+<p>This route indicates which controller class should be loaded if the requested controller is not found. It will override the default 404
+error page. It won't affect to the <samp>show_404()</samp> function, which will continue loading the default <dfn>error_404.php</dfn> file at <var>application/errors/error_404.php</var>.</p>
+
<p class="important"><strong>Important:</strong>&nbsp; The reserved routes must come before any wildcard or regular expression routes.</p>
</div>