Polylang secondary language domain not working with/without www

I’ve set up a WP site using the Polylang plugin with 2 languages that both have their own domains. The site is running on Apache and the config file has aliases set for the secondary domain, both with and without www, to point to the same directory.
The primary domain works as expected but the secondary does not – for some reason trying to access the domain with / without www seems to trigger it to load the default language in either case. Using the setting “The language is set from different domains” under URL modifications, I’ve tried setting the secondary domain both with and without www. I’ve also tried enforcing the domain to www by htaccess, but with no results.
Any ideas? Using WP 4.2.2 and Polylang 1.8.5.

Related posts

1 comment

  1. Kind of a bump to this since it’s a 9 month old post.

    But I ran in to the exact same problem and I figured since I soloved it I might just share what I did, since I found this post others in the same situation might do.

    Here is my code, added to the very top of index.php:

    <?php
    if (($_SERVER['HTTP_HOST'] == 'www.website.com') )
    {
    header('Location: http://website.com');
    }
    ?>
    

    This adds a redirect from www to non-www. This is a fairly “ugly” way to fix the issue.. But hey, if its stupid but it works, its not stupid right?

Comments are closed.