Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 14:00 9:00 – 14:00 9:00 – 14:00 9:00 – 14:00 9:00 – 14:00 -
- 15:00 – 18:00 15:00 – 18:00 15:00 – 18:00 15:00 – 18:00 15:00 – 18:00 -

Supporter timezone: Asia/Dhaka (GMT+06:00)

This topic contains 5 replies, has 2 voices.

Last updated by Prosenjit Barman 6 months ago.

Assisted by: Prosenjit Barman.

Author Posts
May 26, 2024 at 10:34 pm #15671682

olegA-5

Background of the issue:
I was trying to configure WPML to use a directory for the default language (English) and maintain stable links across translations using blacklist-exceptions. I encountered an issue after backing up and restoring the site using All-in-one Migration, where the directory for the default language was removed from all links. The issue can be observed at hidden link.

Symptoms:
After restoring the site from a backup, the directory for the default language was removed from all links, changing the URL structure from 'en/tst-2' to just 'tst-2'.

Questions:
Why does restoring a backup with All-in-one Migration remove the directory from links to pages in the default language?
How can I prevent the directory from being removed from links in the default language after a backup and restore?

May 27, 2024 at 8:52 am #15672865

Prosenjit Barman
Supporter

Languages: English (English )

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

Hello There,
Thanks for contacting WPML Support.

I understand that the default language directory was removed from the link after restoring a backup. If you have enabled the 'Use directory for default language' option, please ensure that the root URL or page is also selected.

From "WPML > Languages > Language URL format," you'll need to select either Root URL or HTML File to make the directory for the default language work properly. For the HTML File option, enter a slash (/) in the box to indicate the root directory. Please check hidden link">this screenshot for a better understanding.

For your information, the directory for the default language option works fine in the sandbox. If it is not working on your end, please make the adjustments mentioned above. If you are still experiencing the issue, please share the exact steps to replicate it. I will then check accordingly and provide further suggestions.

Let me know the update. I will be happy to help if you need further assistance in this matter.

Best regards,
Prosenjit

May 27, 2024 at 11:36 am #15673786

olegA-5

I have the following selected/checked:
- Different languages in directories
- Use directory for default language
- A page _Edit root page_
- Hide language switchers on the root page.
With these settings everything works correctly in principle.
In the sandbox the site structure is correct. And I have the correct site structure before the backup and after restoring from the backup. It's not about site structure. It's not broken. It's the _links_ that are broken. It's about links to the site pages in the default language. Before the backup the link in the sandbox looks like 'en/tst-2', after the backup it looks like 'tst-2'. At the same time, the page the link leads to is still there. Moreover, it will be opened using the wrong link due to the redirect. But the link itself is incorrect. (In general, this causes problems with translations as well, when WPML realises that the fragments do not correspond to the information it has, it starts returning parts of the original text to the translated content, but this is not so important in itself, because it is enough that the links become incorrect and the directory is removed from them).

May 28, 2024 at 4:00 am #15676104

Prosenjit Barman
Supporter

Languages: English (English )

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

Hi There,
Thank you for the detailed update.

The configuration you have for the default language directory seems correct. However, I have rechecked the pages in the sandbox and can see that the default language directory is still showing in the URL. Please check the attached screenshot.

If the issue is occurring specifically in your development environment, you can try the following steps:

1. Go to WPML > Settings.
2. Scroll down to the Translate Link Targets section.
3. Click on the Scan now and adjust links button.

This option often resolves issues with incorrect links that happen after the site migration or backup restoration.

If the issue persists after trying the previous steps, I would greatly appreciate it if you could create a video demonstrating the issue or share some relevant screenshots. This will help me better understand and offer more targetted assistance.

Looking forward to your response.

Best regards,
Prosenjit

Screenshot 2024-05-28 094649.png
May 28, 2024 at 10:59 am #15677887

olegA-5

I'm not talking about page URLs. They're all correct. I am talking about links to these pages, which are included in the text of other pages. Unfortunately, your wizard removed all the details of my initial message, where everything was much more specific. In particular, I detailed what I did in the sandbox. I specified the use of a directory for English, which is the primary language. Then I created page tst-2 (en/tst-2), translated it into French and Spanish, added it to the exclusion blacklist, created page 148-2 (fr/148-2) in French, linked it to page en/tst-2, translated page 148-2 into English and Spanish, and verified that the exclusion blacklist worked correctly, the link in all languages still pointed to the English page despite the existence of translations. I then backed up the site and restored it from the backup and found that _the link to the en/tst-2 page (which is on page 148-2)_ had changed to tst-2 everywhere, with no directory. I assume that WPML is "virtually" creating a directory for the main language in some way that is not handled correctly by All-in-one.

I don't want to resort to backup with such an error, which I have to fix by correcting entries in the database and then updating _all_ pages of the site (translated into 38 languages) via ATE, because WPML/ATE still detects a discrepancy with some of its data, even if I correct all addresses via database.

However, I just ran "Scan now and adjust links" in the sandbox. And that didn't fix the error I'm referring to. Not a single link was corrected. The incorrect links are in place. On this page: hidden link the link after restoring from backup looks like this: hidden link, and before the restoration, it looked like this: hidden link

May 29, 2024 at 6:26 am #15681729

Prosenjit Barman
Supporter

Languages: English (English )

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

Hello There,
Thank you so much for briefly explaining the issue.

Following your instructions, I created a new page and added a link to another page within it. Then, I created a backup using AIO Migration and restored the backup. In the English version, I noticed that the default language directory was removed.

However, when I checked the AIO Migration package, I found a package.json file and noticed that the SiteURL and HomeURL configurations are different. This mismatch in the HomeURL configuration may not have been correctly interpreted during the restoration process, leading to incorrect links.

Interestingly, when I created the package using the Duplicator plugin and restored it, I didn't encounter this issue. The internal links in both the default and other languages were displayed correctly.

Therefore, the issue might be specific to the All-in-One Migration plugin. Could you please try using the Duplicator plugin again? In the meantime, I recommend reporting the issue to the AIO Migration plugin support team and asking them to investigate this scenario. They might be able to provide a better solution in this case.

Let me know the update. I will be happy to help if you need further assistance in this matter.

Best regards,
Prosenjit

The topic ‘[Closed] Error when creating a directory for the default language of the site’ is closed to new replies.