Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Choose language based on domain

Started by Muut Archive 10 years ago · 2 replies · 633 views
10 years ago

Hi community!

I've just released a new grav based website and now want to map different domains to a grav language route. Currently all domains go to the default language.

For example:

domain.com > domain.com/en
domain.de > domain.de/de

Any ideas how to get this behaviour? Maybe it can be realised with the right .htaccess entrys?

Thanks for your help!

10 years ago

Hey rhukster. Thanks a lot for your fast reply and your fantastic support here in this forum.

But the problem that I had was not to switch the TLD when a user switch the site language. Instead I try to map a TLD to a specific site language. Meanwhile I fix it myself by adding the following lines to my .htaccess:

TXT

# Rewrite (www.)domain.de to www.domain.de/de
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.de$ [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ http://www.domain.de/de/ [L,R=301]
---

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 2567 9 years ago
Archive · by Muut Archive, 9 years ago
2 1690 9 years ago
Archive · by Muut Archive, 9 years ago
2 4982 9 years ago
Archive · by Muut Archive, 9 years ago
1 3807 9 years ago
Archive · by Muut Archive, 9 years ago
3 1799 9 years ago