A
A
astaxov812020-06-22 13:32:46
symfony
astaxov81, 2020-06-22 13:32:46

Heading characters in the URL. How to fix?

Hello.
Faced with the task: "Fix uppercase characters in the URL". Now it is quite possible to specify a URL in the site that will contain capital letters:
site.com/blog-ARTICLE-1

Because of this, duplicate pages may result, so you need to fix the problem. I looked at what Google says about this - it all boils down to .htaccess adjustments (or virtual host settings + .htaccess):

  • convert-and-redirect-url-in-uppercase-to-lowercase...
  • htaccess-redirect-url-v-nizhniy-registr

It boils down to the fact that if capital letters are specified, a redirect to the main one occurs. But I have a strong feeling that this is not what I need :)

After digging, I noticed that you can specify an arbitrary register only for slug, the slug is in the database and this field has collation: "utf8mb4_ci", i.e. case-insensitive and that's why, you can safely refer to two URLs:
1. site.com/blog-ARTICLE-1
2. site.com/blog-article-1

I work with Symfony (version 4.3.11) not so long ago, therefore I can't google right away. Is it possible in Doctrine to specify collate case-sensitive? What would 404 appear at the first address? Through an annotation or in any other way.

I will be very grateful for your help.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question