When a route is defined without trailing slash Symfony redirects with 301 to it when accessing the same URL with trailing slash. However in the current Page route definition the pagename parameter would accept anything including trailing slashes and Wordpress would find it and return the correct post, causing 200 responses both in the /{slug} page as well as the /{slug}/, which hurts SEO.
Given that and knowing that Wordpress won't allow slashes in slugs, we change the pagename regex to reject trailing slashes and therefore serve 200 responses on naked slugs and 301 on trailing slashes, as expected.
When a route is defined without trailing slash Symfony redirects with 301 to it when accessing the same URL with trailing slash. However in the current Page route definition the
pagename
parameter would accept anything including trailing slashes and Wordpress would find it and return the correct post, causing 200 responses both in the/{slug}
page as well as the/{slug}/
, which hurts SEO.Given that and knowing that Wordpress won't allow slashes in slugs, we change the
pagename
regex to reject trailing slashes and therefore serve 200 responses on naked slugs and 301 on trailing slashes, as expected.