Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a02187f

Browse filesBrowse files
committed
Merge branch '2.7' into 2.8
* 2.7: Update dependency_injection.rst Fix some misspellings Explained how the URL trailing slash redirection works
2 parents f03492b + 60e0138 commit a02187f
Copy full SHA for a02187f

File tree

Expand file treeCollapse file tree

5 files changed

+28
-4
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+28
-4
lines changed

‎changelog.rst

Copy file name to clipboardExpand all lines: changelog.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2518,7 +2518,7 @@ Fixed Documentation
25182518
- `e385d28 <https://github.com/symfony/symfony-docs/commit/e385d28bee7c7418c8175d43befc4954a43a300c>`_ #3503 file extension correction xfliff to xliff (nixilla)
25192519
- `6d34aa6 <https://github.com/symfony/symfony-docs/commit/6d34aa6038b8317259d2e8fffd186ad24fef5bc5>`_ #3478 Update custom_password_authenticator.rst (piotras-s)
25202520
- `a171700 <https://github.com/symfony/symfony-docs/commit/a171700fb8d9695947bc1b16c6f61c183f296657>`_ #3477 Api key user provider should use "implements" instead of "extends" (skowi)
2521-
- `7fe0de3 <https://github.com/symfony/symfony-docs/commit/7fe0de330b2d72155b6b7ec87c59f5a7e7ee4881>`_ #3475 Fixed doc for framework.session.cookie_lifetime refrence. (tyomo4ka)
2521+
- `7fe0de3 <https://github.com/symfony/symfony-docs/commit/7fe0de330b2d72155b6b7ec87c59f5a7e7ee4881>`_ #3475 Fixed doc for framework.session.cookie_lifetime reference. (tyomo4ka)
25222522
- `8155e4c <https://github.com/symfony/symfony-docs/commit/8155e4cab70e481962a4775274a4412a4465ecdc>`_ #3473 Update proxy_examples.rst (AZielinski)
25232523

25242524
Minor Documentation Changes

‎components/validator.rst

Copy file name to clipboardExpand all lines: components/validator.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Usage
2323

2424
The Validator component behavior is based on two concepts:
2525

26-
* Contraints, which define the rules to be validated;
26+
* Constraints, which define the rules to be validated;
2727
* Validators, which are the classes that contain the actual validation logic.
2828

2929
The following example shows how to validate that a string is at least 10

‎create_framework/dependency_injection.rst

Copy file name to clipboardExpand all lines: create_framework/dependency_injection.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ Now, here is how you can register a custom listener in the front controller::
185185
// ...
186186
use Simplex\StringResponseListener;
187187

188-
$container->register('listener.string_response', StringResposeListener::class);
188+
$container->register('listener.string_response', StringResponseListener::class);
189189
$container->getDefinition('dispatcher')
190190
->addMethodCall('addSubscriber', array(new Reference('listener.string_response')))
191191
;

‎http_cache.rst

Copy file name to clipboardExpand all lines: http_cache.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ two things:
290290
(e.g. deleting a blog post). Caching them would prevent certain requests from hitting
291291
and mutating your application.
292292

293-
* POST requests are generally considered uncachable, but `they can be cached`_
293+
* POST requests are generally considered uncacheable, but `they can be cached`_
294294
when they include explicit freshness information. However POST caching is not
295295
widely implemented, so you should avoid it if possible.
296296

‎routing.rst

Copy file name to clipboardExpand all lines: routing.rst
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,30 @@ that are special: each adds a unique piece of functionality inside your applicat
487487
``_locale``
488488
Used to set the locale on the request (:ref:`read more <translation-locale-url>`).
489489

490+
Redirecting URLs with Trailing Slashes
491+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
492+
493+
Historically, URLs have followed the UNIX convention of adding trailing slashes
494+
for directories (e.g. ``https://example.com/foo/``) and removing them to refer
495+
to files (``https://example.com/foo``). Although serving different contents for
496+
both URLs is OK, nowadays it's common to treat both URLs as the same URL and
497+
redirect between them.
498+
499+
Symfony follows this logic to redirect between URLs with and without trailing
500+
slashes (but only for ``GET`` and ``HEAD`` requests):
501+
502+
---------- ---------------------------------------- ------------------------------------------
503+
Route path If the requested URL is ``/foo`` If the requested URL is ``/foo/``
504+
---------- ---------------------------------------- ------------------------------------------
505+
``/foo`` It matches (``200`` status response) It doesn't match (``404`` status response)
506+
``/foo/`` It makes a ``301`` redirect to ``/foo/`` It matches (``200`` status response)
507+
---------- ---------------------------------------- ------------------------------------------
508+
509+
In summary, adding a trailing slash in the route path is the best way to ensure
510+
that both URLs work. Read the :doc:`/routing/redirect_trailing_slash` article to
511+
learn how to avoid the ``404`` error when the request URL contains a trailing
512+
slash and the route path does not.
513+
490514
.. index::
491515
single: Routing; Controllers
492516
single: Controller; String naming format

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.