Skip Navigation

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

Problem:
If you're experiencing hreflang errors indicating 'Hreflang to redirect or broken hreflangs' during a site audit, and you notice a URL that contains a mix of primary and secondary language indicators but leads to a page only available in the primary language, this could be due to a translated taxonomy (like a category) being assigned to a post that hasn't been translated into the secondary language.
Solution:
To resolve this, you have two options:
1. Translate the post associated with the translated taxonomy to ensure consistency and prevent redirection errors.
2. Remove the translation of the category if the post is not meant to be translated.
For example, if you remove the translated category 'familierecht' from the post 'Erkenning buitenlandse man van Nederlands kind' and assign it to a non-translated category like 'wpmlxyz', the redirection should not occur.
Regarding the use of ChatGPT for translations, currently, ChatGPT is not integrated into the WPML plugin. Our product team is aware of the interest in such a feature and is considering it for future updates.

If this solution doesn't look relevant to your issue, please open a new support ticket with us.

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.

This topic contains 8 replies, has 2 voices.

Last updated by Prosenjit Barman 1 year, 5 months ago.

Assisted by: Prosenjit Barman.

Author Posts
December 28, 2023 at 4:53 pm #15135447

henkt-2

In ahrefs I do a site audit on several links I get the same error messages (see screenshot).
The message is: Hreflang to redirect or broken hreflangs.

An example of such an URL is: hidden link

It contains a mixture of the primary and secondary language. It contains an /en/ part which identicates the secondary language English, and /family-law-topics/ is also English.
But the page itself is in Dutch.
And this page is only available in Dutch it is not translated to English.

Screenshot 2023-12-28 174409.png
December 29, 2023 at 6:50 am #15135979

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hi There,
Thanks for contacting WPML Support.

I checked the English version and understood the issue. From the Header information, I can see that the Redirection is set by WordPress, as you can see from this screenshot: hidden link

In case you're trying to access a page or post that is missing or not available, WordPress has a built-in redirection feature that can redirect users to the closest existing URL or suggest relevant content that matches the URL without causing an error or losing traffic.

However, considering that the translation settings for posts and pages are set to "Translatable - use translation if available or fallback to default language," such redirection should not occur. There may be a specific setting within your site that is initiating this redirection. Could you please try resetting the htaccess file and check if you're still having the issue? Here are the steps to follow.

- Take a full backup of the site including the database
- Remove the caches from the site and server. If any redirection is set manually, remove them as well.
- Navigate to the root directory of your site using the File Manager in your hosting control panel.
- You'll find a file name '.htaccess'. Open the file in Editor.
- Copy the contents within it and save it on your Computer
- Now, replace the htaccess rules with the default rule mentioned here: https://wordpress.org/documentation/article/htaccess/#basic-wp
- Save the changes and try to access the English version of that page.

Let me know if that helps or if you need further assistance in this matter. I will be happy to help.

Best regards,
Prosenjit

December 29, 2023 at 7:41 pm #15137512

henkt-2

Hi Prosenjit,

I'm not very deep in this type of configution. Since I'm hosting at Kinsta I asked them, the responded as follows:

I looked over that thread, and they are asking you to "reset" the .htaccess file to the default settings for WordPress.
The redirect itself is coming from WordPress, which means it's a plugin or theme component configuration that's triggering it in this case. Since there's no .htaccess to reset, there's actually nothing to do on our end.

I looked over the site rules that are already in place; the only things we have in place are a rewrite for WebP and AVIF support (would not affect the links in question), and a rewrite for Rank Math sitemap support (would also not affect the links in question). So it must be coming from inside a plugin 😕

Furthermore, I disabled the plugin Redirection but no change (I didn't expect that).

Does WPML have Nginx-specific configuration settings that they need added?

January 1, 2024 at 3:59 am #15139104

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hi There,
Thank you for the update. Sorry for my delayed reply; I was on a weekend and vacation break.

WPML doesn't require any special setup for nginx servers, except in cases where you've set up the WP-login page to display in different languages. For more details on this configuration, you can visit: https://wpml.org/documentation/getting-started-guide/translating-wordpress-login-and-registration-pages/#translating-login-and-registration-pages-for-sites-that-use-nginx.

However, since you're using the "Redirection" plugin on your site, could you please check within the plugin to see if there's any redirection configured for this link: hidden link?

If you find any, please remove that, clear the caches from the site and browser, and then check again.

However, if you find that no redirection has been set for that link within the "Redirection" plugin, your next step would be to temporarily deactivate all other plugins on your site, except for WPML and its add-ons, and then recheck the issue. If deactivating the plugins resolves the problem, reactivate them one at a time. After each reactivation, verify if the 301 redirection status persists. For checking redirection, you don't need to go to the ahrefs dashboard every time. You can easily monitor it using the Browser Developer Tool or an Online Redirect Checker. To understand how to use these tools, you may refer to this article: hidden link.

Please let me know how it goes. I will be happy to help if you need further assistance in this matter.

Best regards and a very happy New Year to you!

- Prosenjit

January 1, 2024 at 9:36 pm #15139882

henkt-2

Hi Prosenjit,

Happy new year to you.
It's no problem that you have sent your reaction later.

I tried the page you suggested and tested it with hidden link. Further, I also disabled all the plugins, except WPML.

But I don't see any changes, the 301 keeps showing.

If you would, I can provide you the credentials of the website.
For me, it's OK that have you a look and test at the production site.

Thanks, Henk

Screenshot 2024-01-01 215203.png
January 2, 2024 at 11:08 am #15142960

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello Henk,
Thank you for the update.

Since the issue persists, a closer inspection will be required to understand the root cause.

I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to have a testing site where the issue is replicated.

You will find the needed fields below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Maybe I'll need to replicate your site locally. For this, I’ll need to temporarily install a plugin called “Duplicator” or "All in One WP Migration" on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Let me know if this is ok with you.

IMPORTANT
-Please backup site files and database before providing us access.
-If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this:
hidden link

Looking forward to your response.

Best Regards,
Prosenjit

January 3, 2024 at 6:08 am #15145240

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello There,
Thank you for sharing the access information.

I have thoroughly checked the issue and included my findings below.

Firstly, it's important to look at the request initiator chain. You can see this in the screenshot provided here: hidden link. This chain shows what's happening behind the scenes.

Here's what's occurring: Since the "familierecht" category has been translated, the URL now loads with this translated category, which you can see at the beginning of the request initiator chain. However, Since that particular post doesn't exist within this translated category, the built-in redirection feature of WordPress kicks in, trying to redirect you to a closely matching, existing URL with 301 status. This feature is useful for maintaining the user experience and keeping the visitors engaged with the website.

Now, Since the translation preference for the posts is set to "Translatable - use translation if available or fallback to default language" and the language code is loaded in the URL, the system initiates a redirect to display the default post according to the translation settings. At the end, the default post gets loaded with the 301 redirection.

Just to inform you, when you set the translation preference for any post type to "Translatable - use translation if available or fallback to default language", this setting extends to the taxonomies associated with that post type. Consequently, if you translate a taxonomy, it becomes necessary to also translate the posts linked to that taxonomy. If not, you'll encounter redirection issues like the one you're experiencing.

To resolve this issue, you can either translate the post associated with the translated taxonomy or remove the translation of the category itself.

To check, you can remove the "familierecht" category from the "Erkenning buitenlandse man van Nederlands kind" post and instead assign it to the "wpmlxyz" category. Since "wpmlxyz" isn't translated, you'll observe that the redirection doesn't occur.

I hope this explanation is clear. Please feel free to let me know if you need further assistance in this matter. I will be happy to help.

Best regards,
Prosenjit

January 3, 2024 at 5:13 pm #15148231

henkt-2

Hi Prosenjit,

Thanks for your research and extensive explanation, this helps me to understand the problem.
So my conclusion is that I should translate all blog-articles to English. We also have more and more English-speaking clients, so this should sometime be done.

Regarding the translation, I'm always using the standard translation functionality. I noticed that the translation misses the context of the text and, as a result, I don't always get the best translation. Therefore, I apply e.g. Chatgtp as a proofread check of the text.
To improve the translation, would it be possible to change it, e.g., to ChatGPT?

Thanks Henk

January 4, 2024 at 6:55 am #15149254

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello Henk,
Glad to hear that the explanation helped to understand the matter.

Indeed, to prevent the redirection error, it's necessary to finish the translations for all your posts and pages, specifically, if they are assigned to a category thatbis translated.

Regarding your inquiry about ChatGPT: Please note that ChatGPT has not been integrated into the WPML plugin as of now. Consequently, its use in this context is currently not possible.

However, we have received similar requests from numerous users, and our product team is actively researching and exploring the potential for such integration. Hopefully, the ChatGPT will be included as translation engine in a future version of the WPML plugin.

Please let me know if there is anything else if you need help with. I will be happy to assist.

Best regards,
Prosenjit

January 4, 2024 at 8:07 pm #15152901

henkt-2

Thank you so much for your assistance.
My issues will soon be solved. 🙂