Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is experiencing an issue where clicking on the 'Japanese' language link on their WordPress site redirects to the wrong page instead of the Japanese translated page.
Solution:
We discovered that the issue was caused by custom redirect code in the

wp-config.php

file, which was incorrectly redirecting Japanese language links to the homepage. To resolve this, we commented out the problematic code:

// Redirect any /en/ URL to homepage<br />$request_uri = $_SERVER['REQUEST_URI'];<br />if (preg_match('#^/en(/|$)#i', $request_uri)) {<br />    header("Location: https://versa-networks.com/", true, 301);<br />    exit;<br />}<br /><br />if (preg_match('#^/ja(/|$)#i', $request_uri)) {<br />    header("Location: https://versa-networks.com/", true, 301);<br />    exit;<br />}

After making this change, the redirection issue was resolved. We recommend clearing all sorts of cache and verifying if the issue persists.

Please note that this solution might be irrelevant if it's outdated or not applicable to your case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket at WPML support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 4 replies, has 0 voices.

Last updated by Noman 2 weeks, 6 days ago.

Assisted by: Noman.

Author Posts
August 23, 2025 at 9:52 am #17341864

jigneshS

Background of the issue:
I am trying to use WPML on my WordPress site to ensure that language links redirect to the correct translated pages. I have a specific issue with the Japanese language link on my site.

Symptoms:
When I click on the 'Japanese' language link on the page hidden link, it redirects to hidden link instead of the Japanese translated page.

Questions:
Why is the Japanese language link redirecting to the wrong page?
How can I fix the issue with the language link not redirecting to the correct translated page?

August 23, 2025 at 6:10 pm #17342255

Noman
WPML Supporter since 06/2016

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting WPML Support. Could you please try to follow the below steps and see if this resolves the issue:

1. Please make sure the pages are translated into secondary languages.
2. The status of that page is set as Published and not Draft.

Here’s how you can confirm this:
- Go to the Pages >> All Pages page.
- Switch to the secondary language using the admin language switcher and check if they are set as "Draft." as you can see in the attached screenshot.
- If they are, navigate to WPML >> Translations and approve the translations to set them as "Published."
- Clear all sorts of cache from your site/server/CDN and see if this resolves the issue.
3. Enable the Footer language switcher for a moment from WPML >> Languages > Footer language switcher and see if it works correctly with footer language switcher.

Please let me know the results
Thank you

Draft status 1.jpg
Footer lang switcher.jpg
August 25, 2025 at 12:49 pm #17345269

jigneshS

Hi Noman,

Thanks for the followup and instructions. I follow the instructions, all the Japanese pages are in Published state and at WPML >> Translations the pages are showing completed for Japanese language.

We are using the footer language switcher already and from there clicking the Japanese language link go to the main doman (hidden link ).

Please suggest.

August 25, 2025 at 5:03 pm #17345884

Noman
WPML Supporter since 06/2016

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

To take a closer look at this issue, please provide temporary access (WP-Admin and FTP Login info) to your site (preferably staging site), so that I can look into your setup and debug the issue.

Your next answer will be private, meaning only you and I can access it.

=== Please backup your database and website ===

✙ I would need your permission to deactivate and reactivate Plugins and the Theme and to change configurations on the site. This is also a reason the backup is essential.

Thank you

August 26, 2025 at 5:16 pm #17349159

Noman
WPML Supporter since 06/2016

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I thoroughly debugged this issue and found out that there are some custom redirect code in wp-config.php file:

// Redirect any /en/ URL to homepage
$request_uri = $_SERVER['REQUEST_URI'];
if (preg_match('#^/en(/|$)#i', $request_uri)) {
    header("Location: <em><u>hidden link</u></em>", true, 301);
    exit;
}

if (preg_match('#^/ja(/|$)#i', $request_uri)) {
    header("Location: <em><u>hidden link</u></em>", true, 301);
    exit;
}

which causing this issue. I tried to comment out that code and now it works correctly. I also tested by creating a new page: hidden link

Could you please check and confirm after clearing all sorts of cache, and let me know if I missed anything?

Thank you for your cooperation

temp page.jpg
Private browsing.jpg