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.

Author Posts
February 15, 2019 at 10:29 pm #3206734

karimA-4

Hello,

Yoast has been creating wrong redirections when I update pages/posts/tags/categories/locations. I've emailed them and they are pointing their fingers at WPML which would be causing this issue.

See screenshots below:

1) Here you can see that for some reason the Old URL is completely messed up and doubles up the domain

hidden link

2) Here you can see that when I updated a location it made a bad redirection where the old url is the homepage and it redirected it to the location page!

hidden link

I always need to be careful and press undo when this happens, otherwise it breaks my site as a wrong redirection is being created!

Thanks,
Karim

February 17, 2019 at 9:01 pm #3209595

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

By looking at the debug information that you have attached to this ticket I can see the following.
A. In WPML -> Languages -> Language URL format you have set the option 'Different languages in directories'.
B. Then you have also set the option 'Use directory for default language'.
C. For the option 'HTML file' you have set the 'redirect.php'.
Can you please confirm this?

The HTML file for your main domain should be a regular HTML file and not any PHP file. The name of the file implies that it makes some redirection. And indeed, I can see that when I try you main domain here hidden link, I get redirected to the English version here hidden link.
Is it correct and you are forcing a redirection from hidden link to hidden link?
If so, then please disable this redirection because I suspect that it causes this issue.

Thanks,
Itamar.

February 17, 2019 at 9:03 pm #3209598

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

In addition to the above, please also read our instruction about using the option 'Language Directory for the Default Language'.

https://wpml.org/documentation/getting-started-guide/language-setup/directory-default-language/

February 18, 2019 at 3:57 pm #3213198

karimA-4

Hello,

For c) Yes, this is what I have in the redirect.php file:

<?php
/* This will give an error. Note the output
* above, which is before the header() call */
header('Location: hidden link');
exit;
?>

Thanks

February 19, 2019 at 1:23 pm #3216748

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi and thanks for the extra information.

Did you follow my advice to disable this the redirection?
As I told you I'm suspecting that this causes the issue with the Yoast plugin.
You can also check it by disabling the 'Use directory for default language' option.
Please note that you will need to re-save the permalinks of your site.

**** Important! Please make a full site backup (files and DB) before you proceed with those steps****

Thanks,
Itamar.

February 19, 2019 at 7:05 pm #3218616

anthonyB-7

Hi,

Some important details are missing from the problematic.

The OP doesn't want a root page which is why we used redirect.php. The redirect.php is a solution we've found in multiple threads:

https://wpml.org/forums/topic/directory-for-default-language-without-root-page/
https://wpml.org/forums/topic/directly-redirect-to-language-specific-homepage/
https://wpml.org/forums/topic/different-languages-in-directories-10/

Adding a root page using an html file would affect the SEO and it adds a click to get to the home page which is not what we want.

Removing the redirect.php and keeping the page field blank results in exactly the same issue (Yoast creating wrong redirects) so the problem doesn't seem to be the redirect.php.

February 26, 2019 at 6:31 pm #3246765

karimA-4

Hello Itamar, any updates on this following the last message by Anthony?

February 26, 2019 at 11:31 pm #3247705

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, @karima-4

I'm sorry if there was some misunderstanding, but I was waiting to hear from you.
Did you try the suggestions from my previous reply?

Does @anthonyb-7 work with you?
Was he writing on your behalf?

Regards,
Itamar.

February 27, 2019 at 12:07 am #3247745

karimA-4

Hello Itamar, yes @anthonyb-7 works with me, please collaborate with him and answer his previous post...

February 27, 2019 at 10:30 am #3249504

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, @anthonyb-7

You wrote: "The OP doesn't want a root page which is why we used redirect.php."

The default option with WPML is to have no root page. This can set in WPML -> Languages -> Language URL format by unchecking the 'Use directory for default language' option. In case you will have your site's languages as follows.
English: your-domain.com
French: your-domain.com/fr/
Is this a good solution for you?
Does it solve the Yoast issue?
As far as I know, it is a very 'friendly' SEO solution.

At the links that you attach here above to older tickets, there is no mention to the Yoast plugin. Therefore we need to check if that suggested workaround as any incompatibility with the Yoast plugin which is your case. But first, please let me know if the suggested workaround at the following link does not solve the issue with Yoast.
https://wpml.org/forums/topic/different-languages-in-directories-10/#post-1219304
I'm mentioning it because you only told me that the redirect.php is having an issue with the Yoast plugin. But did you try to set everything, including step 2, as suggested above?

If you are still having the issue, then we need to see if it can be replicated on a clean WordPress installation. For this, I created a test website with a clean WordPress install. You can access it through this link:
hidden link
Through this link, you will be automatically logged in. (If nobody logs in the test site will be available for one week from today.) Please install the Yoast premium on this site and configure WPML as it is configured on your site and see if the issue is replicable on a clean WordPress installation. Please make sure that you are installing the latest version of the Yoast plugin. If you need FTP access to upload the redirect.php to the root of the WordPress installation, you can find it here.
hidden link

Please let me know of your findings and if the issue is replicable on a clean install then let me know how I can see it.

Thanks,
Itamar.

February 28, 2019 at 4:48 pm #3256607

karimA-4

Hello Itamar,

I need the following URL structure:

English: hidden link... (Main language)
French: hidden link... (Secondary language)

The "master domain" hidden link should redirect to hidden link by default.

Thanks
Karim

February 28, 2019 at 11:58 pm #3257723

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, Karim.

In this case, could you please try to replicate this issue on the test site that I've created?
All the explanations are in my previous reply. Then I'll be able to show this problem to our compatibility team and ask for their advice about it.

Thanks,
Itamar.

The topic ‘[Closed] Wrong redirections are being created after updating pages/posts/tags/etc…’ is closed to new replies.