2
2 Comments

Today I learned how to build a dual-language landing page

Today, I built an English and a German landing page for my new product Yes But Not For Long, using good old Apache behind nginx.

The Apache web server delivers the correct version of the page automatically, depending on the visitor's browser language setting. Additionally, the visitor can switch manually between English and German with one click.

It wasn't easy to figure out the correct settings for .htaccess and index.html.var so that index.en.html and index.de.html are selected correctly.

.htaccess

AddHandler type-map .var
MultiviewsMatch Any

Options +MultiViews

DirectoryIndex index.html.var

LanguagePriority en de
ForceLanguagePriority Fallback

index.html.var

URI: index.html

Content-language: en
Content-type: text/html
URI: index.en.html

Content-language: de, de-de, de-at, de-ch, de-li, de-lu
Content-type: text/html
URI: index.de.html

Result

https://yesbutnotforlong.com

I always love to get questions and feedback here. And, oh yes, sign-ups are also welcome, of course! 😎👋✅

  1. 1

    OK, and today I learnt about hreflang and canonicalization to have correct settings for SEO. See these pages here:

  2. 1

    Slick. I've been using content management systems so long it's nice to see how this is implemented and supported via htaccess and browser language settings. :thumbsup:

Trending on Indie Hackers
How I grew a side project to 100k Unique Visitors in 7 days with 0 audience 47 comments Competing with Product Hunt: a month later 33 comments Why do you hate marketing? 27 comments $15k revenues in <4 months as a solopreneur 14 comments Use Your Product 13 comments How I Launched FrontendEase 13 comments