Skip Navigation

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

Problem: Disable root page for language

Solution: While using Directory for the default language option of WPML Language URL format we have to do the following steps to disable the root page for the site.

1) Create a new PHP file *root-page.php* and place it in the *Root folder* of the site

2) Add the following code in the *root-page.php* file and save the changes

<?php
 
header('Location: http://www.yoursite.host/en');
 
?>

3) Visit WPML>>Languages>>Language URL format

4) Add *root-page.php* as the value for *HTML file* field of *Use directory for default language* option

5) Save the settings

6) Visit Settings>>Permalinks and resave the settings

Relevant Documentation: https://wpml.org/documentation/getting-started-guide/language-setup/directory-default-language/#selecting-an-html-file

https://wpml.org/forums/topic/disable-root-page-for-language/#post-11189877

100% of people find this useful.

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 2 replies, has 2 voices.

Last updated by ernestC-2 1 year, 11 months ago.

Assisted by: Bigul.

Author Posts
May 10, 2022 at 10:15 am #11188151

ernestC-2

Dear Sir/Madam,

I have added a /en for my website and previously, and my website was working fine. When user type hidden link, it will redirect to hidden link automatically.

However, from yesterday onward, when I type hidden link, the URL does not redirect anymore, how may I fix it?

Thank you,

Ernest

Screenshot 2022-05-10 at 6.13.24 PM.png
Screenshot 2022-05-10 at 6.09.00 PM.png
May 10, 2022 at 1:19 pm #11189877

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hi Ernest,

Welcome to the WPML support forum. I will do my best to help you to resolve the issue.

Hope you are trying to redirect a user visiting hidden link from to hidden link.

If so, please try the following steps after a full site backup and let us know your feedback.

1) Create a new PHP file *root-page.php* and place it in the *Root folder* of the site

2) Add the following code in the *root-page.php* file and save the changes

<?php
 
header('Location: <em><u>hidden link</u></em>');
 
?>

3) Visit WPML>>Languages>>Language URL format

4) Add *root-page.php* as the value for *HTML file* field of *Use directory for default language* option

5) Save the settings

6) Visit Settings>>Permalinks and resave the settings

Please refer to the following documentation for more details.

https://wpml.org/documentation/getting-started-guide/language-setup/directory-default-language/#selecting-an-html-file

--
Thanks!

Bigul

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.