Skip to content

Commit 6d1b77f

Browse files
committed
[cookbook] Minor tweaks to new apache route dumper article - see #1347
1 parent 96cec44 commit 6d1b77f

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

cookbook/configuration/apache_router.rst

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
.. index::
22
single: Apache Router
33

4-
How to use Apache Router
5-
========================
4+
How to use the Apache Router
5+
============================
66

77
Symfony2, while fast out of the box, also provides various ways to increase that speed with a little bit of tweaking.
88
One of these ways is by letting apache handle routes directly, rather than using Symfony2 for this task.
99

1010
Change Router Configuration Parameters
1111
--------------------------------------
1212

13-
To to be to dump Apache routes we must first tweak configuration parameters and tell
14-
Symfony2 to use ApacheUrlMatcher instead of the default one:
13+
To dump Apache routes we must first tweak some configuration parameters to tell
14+
Symfony2 to use the ``ApacheUrlMatcher`` instead of the default one:
1515

1616
.. code-block:: yaml
1717
@@ -22,12 +22,14 @@ Symfony2 to use ApacheUrlMatcher instead of the default one:
2222
2323
.. tip::
2424

25-
Note that :class: `Symfony\\Component\\Routing\\Matcher\\ApacheUrlMatcher` extends :class: `Symfony\\Component\\Routing\\Matcher\\UrlMatcher` so even if you don't regenerate
26-
the url_rewrite rules, everything will work (because at the end of **ApacheUrlMatcher::match()**
27-
a call to **parent::match()** is done).
25+
Note that :class:`Symfony\\Component\\Routing\\Matcher\\ApacheUrlMatcher`
26+
extends :class:`Symfony\\Component\\Routing\\Matcher\\UrlMatcher` so even
27+
if you don't regenerate the url_rewrite rules, everything will work (because
28+
at the end of ``ApacheUrlMatcher::match()`` a call to ``parent::match()``
29+
is done).
2830

2931
Generating mod_rewrite rules
30-
---------------------------
32+
----------------------------
3133

3234
To test that it's working, let's create a very basic route for demo bundle:
3335

@@ -57,9 +59,10 @@ Which should roughly output the following:
5759
RewriteCond %{REQUEST_URI} ^/hello/([^/]+?)$
5860
RewriteRule .* app.php [QSA,L,E=_ROUTING__route:hello,E=_ROUTING_name:%1,E=_ROUTING__controller:AcmeDemoBundle\:Demo\:hello]
5961
60-
You can now rewrite `web/.htaccess` to use new rules, so with our example it should look like this:
62+
You can now rewrite `web/.htaccess` to use the new rules, so with our example
63+
it should look like this:
6164

62-
.. code-block:: text
65+
.. code-block:: apache
6366
6467
<IfModule mod_rewrite.c>
6568
RewriteEngine On
@@ -83,7 +86,8 @@ You're now all set to use Apache Route rules.
8386
Additional tweaks
8487
-----------------
8588

86-
To save a little bit of processing time, change in **web/app.php** occurences of **Request** into **ApacheRequest**::
89+
To save a little bit of processing time, change occurrences of ``Request``
90+
to ``ApacheRequest`` in ``web/app.php``::
8791

8892
// web/app.php
8993

cookbook/configuration/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ Configuration
77
environments
88
external_parameters
99
pdo_session_storage
10+
apache_router

cookbook/map.rst.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* :doc:`/cookbook/configuration/environments`
2222
* :doc:`/cookbook/configuration/external_parameters`
2323
* :doc:`/cookbook/configuration/pdo_session_storage`
24+
* :doc:`/cookbook/configuration/apache_router`
2425

2526
* **Console Commands**
2627

0 commit comments

Comments
 (0)