[Resolved] 404 redirect plugin causes language switcher bug
This thread is resolved. Here is a description of the problem and solution.
Problem:
Translated 404 page does not show up on requests to non-existent URLs in secondary language.
Solution:
Translate custom URL setting for the 404 to 301 - Redirect plugin.
Relevant Documentation:
In the WordPress dashboard, go to WPML → String Translation
In the "Select strings within domain:" drop-down, find admin_texts_i4t3_gnrl_options (or the relevant domain for the plugin being used for redirection), click Search
There should be a result similar to [i4t3_gnrl_options]redirect_link - or the relevant result containing the URL in the original language
Click on its Translations and insert the URL of the 404 page in secondary language
To get the URL, in WordPress admin dashboard go to Pages, click on the secondary language name above the pages list to show only pages in that language, find the 404 page, mouse over it and click "View", then copy the URL from the browser bar
The language switcher in the top navigation menu of my website does not work.
Carlos from your team has found out, that this issue is related to the 404-redirect plugin I'm using.
I've tried the plugins for the 404 redirect which were recommended by WPML:
404page and 404to301 redirect.
With 404page the language switcher always gets a (real) 404 error. With 404to301 the language switcher links to the current page instead of the translated one.
Carlos asked me to create a separate ticked for this for your 2nd level support.
I got 2 languages on my website: English (original) and German (translations). With the 4040 plugin I'd like to be able to link to a custom 404 page. This page is available in two languages, too. So if the 404 happens on a English page, the plugin should forward to the English 404 page. If the the 404 happens with a German page, the plugin should forward to the German 404 page.
My setup:
- Theme: TheGem
- Website not live, Coming soon plugin active
- URL: <a href="hidden link />- Languages: Original = English, Translation = German
- Login credentials: are added below in your ticket interface
- WPML Setup (plugins, php, wordpress version): See screenshot 00-wpml-settings
Could you please help me with this?
It's probably better to handle this as a ticket instead of within the chat.
Thank you so much for getting the test site migrated.
As I suspected, the plugin works - just needs its custom URL setting "translated". Right now it knows where to redirect in case of a 404 in English, but not in German.
Here are the steps:
In the WordPress dashboard, go to WPML → String Translation
In the "Select strings within domain:" drop-down, find admin_texts_i4t3_gnrl_options, click Search
There should be 1 result: [i4t3_gnrl_options]redirect_link (see screenshot)
Click on Translations and insert the URL of your 404 page in German
To get the URL, in WordPress admin dashboard go to Pages, click on "German" filter above the list, find the 404 page, mouse over it and click "View", then copy the URL from the browser bar
Check the Translation is complete box, Save
Try going to a non-existent URL in German, like hidden link - should see the German 404 page