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 d2030b2

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

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
@@ -2622,7 +2622,7 @@ Fixed Documentation
26222622
- `e385d28 <https://github.com/symfony/symfony-docs/commit/e385d28bee7c7418c8175d43befc4954a43a300c>`_ #3503 file extension correction xfliff to xliff (nixilla)
26232623
- `6d34aa6 <https://github.com/symfony/symfony-docs/commit/6d34aa6038b8317259d2e8fffd186ad24fef5bc5>`_ #3478 Update custom_password_authenticator.rst (piotras-s)
26242624
- `a171700 <https://github.com/symfony/symfony-docs/commit/a171700fb8d9695947bc1b16c6f61c183f296657>`_ #3477 Api key user provider should use "implements" instead of "extends" (skowi)
2625-
- `7fe0de3 <https://github.com/symfony/symfony-docs/commit/7fe0de330b2d72155b6b7ec87c59f5a7e7ee4881>`_ #3475 Fixed doc for framework.session.cookie_lifetime refrence. (tyomo4ka)
2625+
- `7fe0de3 <https://github.com/symfony/symfony-docs/commit/7fe0de330b2d72155b6b7ec87c59f5a7e7ee4881>`_ #3475 Fixed doc for framework.session.cookie_lifetime reference. (tyomo4ka)
26262626
- `8155e4c <https://github.com/symfony/symfony-docs/commit/8155e4cab70e481962a4775274a4412a4465ecdc>`_ #3473 Update proxy_examples.rst (AZielinski)
26272627

26282628
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
@@ -196,7 +196,7 @@ Now, here is how you can register a custom listener in the front controller::
196196
// ...
197197
use Simplex\StringResponseListener;
198198

199-
$container->register('listener.string_response', StringResposeListener::class);
199+
$container->register('listener.string_response', StringResponseListener::class);
200200
$container->getDefinition('dispatcher')
201201
->addMethodCall('addSubscriber', array(new Reference('listener.string_response')))
202202
;

‎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
@@ -291,7 +291,7 @@ two things:
291291
(e.g. deleting a blog post). Caching them would prevent certain requests from hitting
292292
and mutating your application.
293293

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

‎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
@@ -494,6 +494,30 @@ that are special: each adds a unique piece of functionality inside your applicat
494494
``_locale``
495495
Used to set the locale on the request (:ref:`read more <translation-locale-url>`).
496496

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