I'm trying to set up multilingual WordPress site using the PolyLang plugin. My website will have 3 languages - Ukrainian, Russian and English. Ukrainian default.
In the URL settings of polylang, there is an option to select a language by subdomain. The idea is that the URLs looks like this: “example.com” - is the default Ukrainian language main page of the site. “ru.example.com” - is Russian language, and “en.example.com” is English.
On the hosting, I have already created two subdomains ru and en. In the server root directory, there are 2 folders with the appropriate names. My question is whether it is possible and how to configure the .htaccess file like this: when a visitor gets to the subdomain page - the server returns not the file in the corresponding folder, but the index.php file located in the root.
I have already tried to do this:
RewriteCond %{HTTP_HOST} ^ru\.example\.com [NC]
RewriteRule . /index.php [P]
And that's not worked. Not any results, just like nothing changed.
Here is full .htaccess file from the root:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^ru\.example\.com [NC]
RewriteRule . /index.php [P]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Maybe I need to create and write .htaccess files in subdomain folders...
Thanks for any suggestions!