Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.htaccess subdomain languages

Im running a WordPress site with qTranslate installed. The URLS are currently displayed as http://domain.com/en/ but i would like to change them to http://en.domain.com

How do i make this work? qTranslate has a built-in pre-domain mode, which should do exactly what i need. But all it does is change the links (works), when visiting the page i get a 404 error.

In the admin it says "Pre-Path and Pre-Domain mode will only work with mod_rewrite/pretty permalinks. Additional Configuration is needed for Pre-Domain mode!"

I got pre-path working and i think im using pretty permalinks (/%category%/%postname%/), but ive got no idea what kind of 'additional configuration' is needed.

My .htaccess looks like this (i think standard wp output);

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
</IfModule>

I tried a lot of different things found online, but i mostly get internal server errors or just the 404.

Thanks in advance!

like image 647
Tony Avatar asked Nov 13 '22 05:11

Tony


1 Answers

If your default url starts with www (like www.domain.com) then your translated urls will look like en.www.domain.com.

But if you try to login en.domain.com, you may think that your plugin doesn't working.

  • Before try anything be sure that any subdomains shows your WordPress homepage. With default settings WordPress should not redirect to you anywhere.

  • Then set your default url without www prefix (for ex. domain.com)

  • And check the permalink finally

If you fail at any steps, disable all plugins and even change your theme to default one.

like image 164
tolginho Avatar answered Nov 15 '22 05:11

tolginho