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-see ⟶ www.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.
@fredericalpers
According to my understanding:
1. Your problem:
- When using "language switch":
Example (from DE ⟶ to EN): transition from German to English
"www.test.de/detail/1234-haus-am-see/"
=> an interim redirection to a URL without the complete path(www.test.de/en/detail/1234/ )
=>Then, redirect to the final user-friendly URL( www.test.de/en/detail/1234-house-by-the-lake/)
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/
- Here is a video we implemented to try redirecting directly to the final user-friendly URL.
Please watch the video and let me know if it works fine same as your desire.
https://github.com/onOffice-Web-Org/oo-wp-plugin/assets/104892108/98c395f6-f8d1-43ac-bf08-866168048ed6
@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.