Skip to content

Instantly share code, notes, and snippets.

@michaelklapper
Last active December 16, 2015 05:09
Show Gist options
  • Save michaelklapper/5382239 to your computer and use it in GitHub Desktop.
Save michaelklapper/5382239 to your computer and use it in GitHub Desktop.
Browser language detection ==================== This is a simple rewrite to detect Browser language and redirect to a root page depending on the language setting.
## If the user has a browser with german language
## and visits the root page
## than redirect to the german default startpage: http://www.HOST.com/de/produkte.html
RewriteCond %{HTTP:Accept-Language} ^de.*$ [NC]
RewriteRule ^$ http://%{HTTP_HOST}/de/produkte.html [L,R=302]
## If the user has a browser with a non german language
## and visits the root page
## than redirect to the english default startpage: http://www.HOST.com/en/products.html
RewriteCond %{HTTP:Accept-Language} !^de.*$ [NC]
RewriteRule ^$ http://%{HTTP_HOST}/en/products.html [L,R=302]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment