URL modifications

Polylang provides several methods to set the language from the URL. These can be configured in Languages > Settings.

The available options depend on your WordPress permalink structure.

When using Pretty Permalinks (/%postname%/, /blog/%postname%/, etc.)

1. When using plain permalinks (?p=123), you can set the language from the code in the URL

This option is checked by default if your Permalinks settings are set to Plain.


For a site in English and in French, your posts URLs would look like:

http://www.yoursite.com/?lang=en&p=2

http://www.yoursite.com/?lang=fr&p=3

This method ensures high compatibility with third-party plugins and themes, as it doesn’t interfere with the permalink structure.

This option is selected by default when Pretty Permalinks are enabled in WordPress. In most cases, you should keep this option as is, unless you know what you are doing. For a site in English and in French, your posts URLs would look like:

http://www.yoursite.com/en/my-post/

http://www.yoursite.com/fr/mon-article/

Note: if Polylang is deactivated, URLs will lose their language information and thus all external links are broken.

3. When using pretty permalinks, you can use subdomain names or multiple domains

For advanced users, it is possible to use subdomains (or a different domain per language). All your subdomains (or domains) must point to the same WordPress root directory (where the WordPress index.php is present). Polylang will check if your setup is correct and display an error if not. If needed, contact your hosting provider for documentation on how to configure subdomains or additional domains.

Note: we know that the interface of some host providers does not allow choosing the directory where a subdomain is pointing. Check with your host provider if it offers this possibility.

4. Hide URL language information for default language

🔧 Useful when installing Polylang on an existing site to keep legacy URLs intact.  This option hides the language code in the URL only for the default language. In this case, the monthly archives URL will look
like:

Default language: http://www.yoursite.com/2015/03/

Other language: http://www.yoursite.com/fr/2015/03/

This setting lets you add or remove the language keyword in archive URLs.

With /languages/, the monthly archive URL will look like:
http://www.yoursite.com/language/en/2015/03/

Without /language/, the monthly archive URL will look like:
http://www.yoursite.com/en/2015/03/

6. The front page url contains the language code instead of the page name or page id

Available only when using a static front page (Settings > Reading).

For a site in English and in French, the URLs of your home pages would look like:

http://www.yoursite.com/en/
http://www.yoursite.com/fr/

instead of

http://www.yoursite.com/en/home/
http://www.yoursite.com/fr/home-fr/

If English is your default language and the option to hide the language code for the default language is enabled, your URLs will look like:

http://www.yoursite.com/
http://www.yoursite.com/fr/