strarsis / polylang-intro-page

Polylang Extension for an intro / language selection page
MIT License
2 stars 0 forks source link

URLs are accessible without language code (duplicated content) #1

Open charlieelcarlino opened 3 years ago

charlieelcarlino commented 3 years ago

I have "Hide URL language information for default language" disabled.

With these settings, the normal behaviour is that if I hit any URL without the language code, like mydomain.com/my-url it redirects to mydomain.com/es/my-url (or returns 404, that works too)

However this is not happening since I installed this extension: any URL is also accessible without the language code.

Language neutral homepage is great, but this issue exposes a lot of duplicated content for Google and forces me to add a manual redirect every time I publish a post. Is there any chance it can be fixed?

Thanks a lot for your time

strarsis commented 3 years ago

@charlieelcarlino: Thanks for the report. To summarize this issue:

  1. By default, Polylang redirects URLs without a language code to URLs with a language code of default locale.
  2. With this extension plugin enabled, Polylang doesn't redirect to the URL with language code of default locale anymore, and just serves the page under default locale.

So to reproduce this issue:

  1. Install and enable Polylang and this plugin.
  2. Disable Hide URL language information for default language option.
  3. Visit a valid URL without the language code - the page would show up for that URL, without redirection to an URL that has the language code of default locale.

Does this describe your issue correctly?

charlieelcarlino commented 3 years ago

Yes, exactly. :)

El jue., 8 abr. 2021 17:34, strarsis @.***> escribió:

@charlieelcarlino https://github.com/charlieelcarlino: Thanks for the report. To summarize this issue:

  1. By default, Polylang redirects URLs without a language code to URLs with a language code of default locale.
  2. With this extension plugin enabled, Polylang doesn't redirect to the URL with language code of default locale anymore, and just serves the page under default locale.

So to reproduce this issue:

  1. Install and enable Polylang and this plugin.
  2. Disable Hide URL language information for default language option.
  3. Visit a valid URL without the language code - the page would show up for that URL, without redirection to an URL that has the language code of default locale.

Does this describe your issue correctly?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/strarsis/polylang-intro-page/issues/1#issuecomment-815921373, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIRSBX4VKXSPXTIXARIQ4HTTHXEJJANCNFSM42SWAXFA .

strarsis commented 3 years ago

@charlieelcarlino: Yes, I also had to use some redirects for this and this is unnecessarily annoying. I will take a look into it when I have some time, probably next week.

charlieelcarlino commented 3 years ago

Thanks!

El sáb, 10 abr 2021 a las 1:06, strarsis @.***>) escribió:

@charlieelcarlino https://github.com/charlieelcarlino: Yes, I also had to use some redirects for this and this is unnecessarily annoying. I will take a look into it when I have some time, probably next week.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/strarsis/polylang-intro-page/issues/1#issuecomment-817018199, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIRSBXYC3FB6OCX7EMVNAP3TH6CAVANCNFSM42SWAXFA .

charlieelcarlino commented 3 years ago

Hi, did you have the chance to check this?

Also I found that the homepage sometimes gets stuck in a redirect loop between .com and .com/es/intro/:

[image: image.png]

I think this started happening when I hired someone to optimize the site and he added some cache plugins. However he tried excluding the homepage from every optimization plugin and this still happens from time to time (we can't find a pattern).

Do you have any idea of what could be the reason?

Thanks!

El dom, 11 abr 2021 a las 0:58, Charlie Pug @.***>) escribió:

Thanks!

El sáb, 10 abr 2021 a las 1:06, strarsis @.***>) escribió:

@charlieelcarlino https://github.com/charlieelcarlino: Yes, I also had to use some redirects for this and this is unnecessarily annoying. I will take a look into it when I have some time, probably next week.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/strarsis/polylang-intro-page/issues/1#issuecomment-817018199, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIRSBXYC3FB6OCX7EMVNAP3TH6CAVANCNFSM42SWAXFA .

charlieelcarlino commented 3 years ago

@strarsis hi, do you have any idea of what can be causing the homepage redirect bug? I can't find the reason...

Thanks

strarsis commented 3 years ago

@charlieelcarlino: So I looked into this and noticed that the current approach, using a sequence of very specific hooks, is very brittle and causes this unintended behavior. Because of this I rewrite the plugin to use different, better suited hooks instead.