.htaccess wordpress wpml uses the same name for individual pages

I am using wordpress with WPML and I ran into a little problem. The previous website had URLs in this format:

domain.com/lang/title-inglish.html

eg:

-> domain.com/hello-world.html {English users}

-> domain.com/fr/hello-world.html {French users}

The problem is that WPML {Multi language plugin for wordpress} creates a new page for each translation, and wordpress does not allow users to use the same title twice, so it adds this suffix:

-> domain.com/hello-world.html {English users}

-> domain.com/fr/hello-world-2.html {French users}

Good thing that somehow domain.com/fr/hello-world.html points to domain.com/fr/hello-world-2.html the same ...

So...

- R 301 hello-world-2.html hello-world.html

"-2" {-anynumber} URLS

!

+3
2

htaccess:

RewriteRule ^(.*)-[0-9]+\.html?$ $1\.html [R]

, wordpress... .

+2

WordPress , .

, .

WordPress, , qTranslate. , qTranslate . .

, :

  • WPML: , .

  • qTranslate: , .

0

Source: https://habr.com/ru/post/1775429/


All Articles