onOffice-Web-Org/oo-wp-plugin

Unnecessary redirects for multilingual pages with user-friendly URLs

Closed this issue · 7 comments

Initiative

Multilingual SEO optimization

Epic

URL structure enhancement for language switch

User story

As a real estate agent aiming for optimal SEO ranking and user-friendly URLs, I want the URL redirection during language switches to be seamless and consistent. Currently, the language switch causes unnecessary redirections and inconsistent URL structures, potentially impacting the SEO ranking.

The current implementation of URL redirection during a language switch results in suboptimal outcomes. Transitioning from German to English involves an interim redirection to a URL without the complete path, followed by another redirection to the final user-friendly URL.

(From DE ⟶ EN):
www.test.de/detail/1234-haus-am-see/www.test.de/en/detail/1234/www.test.de/en/detail/1234-house-by-the-lake/

(From EN ⟶ DE):
www.test.de/en/detail/1234-house-by-the-lake/www.test.de/en/detail/1234/www.test.de/detail/1234-haus-am-seewww.test.de/detail/1234-haus-am-see/

This behavior needs enhancement to eliminate unnecessary redirects and enhance the SEO-friendliness of the website.

Tasks

  • Analyse the existing code and understand the mechanism governing URL redirection during language switch.
  • Adjust the logic to ensure direct rediretion to the final user-friendly URL without unnecessary intermediate steps.
  • Implement consistent handling of trailing slahes to ensure uniformity in URL structures.
  • Ensure that the changes are backward-compatible and existing URLs are correctly redirected.

The implementation of this change aims to ensure that URL redirection during language switches on my real estate website works seamlessly, contributing to optimal SEO ranking and improved user experience.

redirect-de-zu-en_current JPG (3)
redirect-en-wieder-zu-de_current JPG (3)

@fredericalpers
According to my understanding:
1. Your problem:

2. Your desire:
Transition from German to English URL will redirect directly to the final user-friendly URL?
www.test.de/detail/1234-haus-am-see/ => www.test.de/en/detail/1234-house-by-the-lake/

@yeneastgate yes, we need to eliminate the interim redirection, to always redirect to the final user-friendly URL. The step in between is bad for SEO.

In the video it seems to be working fine :) thank you

@fredericalpers so I need a day to implement and test it. Thanks!

@fredericalpers I created a PR for this issue. Please take a look at my video demo. Thanks!

cmt_731.mp4

@yeneastgate the video result looks good! is there any chance you can test it with the chrome browser extension Link Redirect Trace and comment the results here aswell? Thank you in advance :)

@fredericalpers Okay, I will record a video and send it back later.

@fredericalpers Here is my video test with the Chrome browser extension.

chrome_extension.mp4