-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apache: redirect homepage based on accept-language
- Loading branch information
Showing
1 changed file
with
29 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,11 @@ | |
DocumentRoot /var/www/404 | ||
|
||
RewriteEngine On | ||
RewriteCond %{HTTP:Accept-Language} ^de [NC] | ||
RewriteRule ^/$ https://berlin.freifunk.net/de/ [R=302,L] | ||
RewriteCond %{REQUEST_URI} !^/.well-known/ | ||
RewriteRule ^/$ https://berlin.freifunk.net/de/ [R=301,L] | ||
RewriteRule ^/index_en https://berlin.freifunk.net/en/ [R=301,L] | ||
RewriteRule ^/$ https://berlin.freifunk.net/en/ [R=302,L] | ||
RewriteRule ^/index_en/$ https://berlin.freifunk.net/en/ [R=301,L] | ||
RewriteRule ^/network https://berlin.freifunk.net/de/map/ [R=301,L] | ||
RewriteRule ^/contact/$ https://berlin.freifunk.net/de/contact/ [R=301,L] | ||
RewriteRule ^/contact_en/$ https://berlin.freifunk.net/en/contact/ [R=301,L] | ||
|
@@ -18,6 +20,10 @@ | |
RewriteRule ^/wiki/$ https://berlin.freifunk.net/de/wiki/ [R=301,L] | ||
RewriteRule ^/meshwiki$ https://berlin.freifunk.net/de/wiki/ [R=301,L] | ||
RewriteRule .* https://berlin.freifunk.net%{REQUEST_URI} [R=301,L] | ||
|
||
<LocationMatch "^/$"> | ||
Header always merge Vary "Accept-Language" | ||
</LocationMatch> | ||
</VirtualHost> | ||
|
||
<VirtualHost *:443> | ||
|
@@ -29,8 +35,10 @@ | |
SSLCertificateKeyFile /etc/letsencrypt/live/www.berlin.freifunk.net/privkey.pem | ||
|
||
RewriteEngine On | ||
RewriteCond %{HTTP:Accept-Language} ^de [NC] | ||
RewriteRule ^/$ https://berlin.freifunk.net/de/ [R=302,L] | ||
RewriteCond %{REQUEST_URI} !^/.well-known/ | ||
RewriteRule ^/$ https://berlin.freifunk.net/de/ [R=301,L] | ||
RewriteRule ^/$ https://berlin.freifunk.net/en/ [R=302,L] | ||
RewriteRule ^/index_en https://berlin.freifunk.net/en/ [R=301,L] | ||
RewriteRule ^/network https://berlin.freifunk.net/de/map/ [R=301,L] | ||
RewriteRule ^/contact/$ https://berlin.freifunk.net/de/contact/ [R=301,L] | ||
|
@@ -43,15 +51,25 @@ | |
RewriteRule ^/meshwiki$ https://berlin.freifunk.net/de/wiki/ [R=301,L] | ||
RewriteRule ^/impressum/$ https://berlin.freifunk.net/de/impressum/ [R=301,L] | ||
|
||
<LocationMatch "^/$"> | ||
Header always merge Vary "Accept-Language" | ||
</LocationMatch> | ||
</VirtualHost> | ||
|
||
<VirtualHost *:80> | ||
ServerName www.berlin.freifunk.net | ||
ServerAdmin "[email protected]" | ||
|
||
RewriteEngine On | ||
RewriteCond %{HTTP:Accept-Language} ^de [NC] | ||
RewriteRule ^/$ https://berlin.freifunk.net/de/ [R=302,L] | ||
RewriteCond %{REQUEST_URI} !^/.well-known/ | ||
RewriteRule .* https://berlin.freifunk.net/de/ [R=301,L] | ||
RewriteRule ^/$ https://berlin.freifunk.net/en/ [R=302,L] | ||
RewriteRule .* https://berlin.freifunk.net/en/ [R=301,L] | ||
|
||
<LocationMatch "^/$"> | ||
Header always merge Vary "Accept-Language" | ||
</LocationMatch> | ||
</VirtualHost> | ||
|
||
<VirtualHost *:443> | ||
|
@@ -65,8 +83,10 @@ | |
DocumentRoot /var/www/berlin.freifunk.net/www | ||
|
||
RewriteEngine On | ||
RewriteCond %{HTTP:Accept-Language} ^de [NC] | ||
RewriteRule ^/$ https://berlin.freifunk.net/de/ [R=302,L] | ||
RewriteCond %{REQUEST_URI} !^/.well-known/ | ||
RewriteRule ^/$ https://berlin.freifunk.net/de/ [R=301,L] | ||
RewriteRule ^/$ https://berlin.freifunk.net/en/ [R=302,L] | ||
RewriteRule ^/index_en https://berlin.freifunk.net/en/ [R=301,L] | ||
RewriteRule ^/network https://berlin.freifunk.net/de/map/ [R=301,L] | ||
RewriteRule ^/contact/$ https://berlin.freifunk.net/de/contact/ [R=301,L] | ||
|
@@ -78,6 +98,10 @@ | |
RewriteRule ^/wiki/$ https://berlin.freifunk.net/de/wiki/ [R=301,L] | ||
RewriteRule ^/meshwiki$ https://berlin.freifunk.net/de/wiki/ [R=301,L] | ||
|
||
<LocationMatch "^/$"> | ||
Header always merge Vary "Accept-Language" | ||
</LocationMatch> | ||
|
||
Header set Content-Security-Policy "script-src berlin.freifunk.net" | ||
Header set Strict-Transport-Security "max-age=63072000; includeSubDomains" | ||
|
||
|