main.conf 1.58 KB
Newer Older
ale's avatar
ale committed
1 2 3 4 5 6 7 8 9 10 11 12
<VirtualHost *:${APACHE_PORT}>
	ServerName www.autistici.org
	ServerAlias www.inventati.org
	ServerAlias autistici.org
	ServerAlias inventati.org

	DocumentRoot /var/www/autistici.org
	<Directory "/var/www/autistici.org">
		AllowOverride All
		Options Indexes MultiViews FollowSymLinks
		DirectoryIndex index
		MultiViewsMatch Handlers Filters
ale's avatar
ale committed
13
		Require all granted
ale's avatar
ale committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
	</Directory>

	#AddDefaultCharset utf-8

	# Make the 'site_language' cookie override the Accept-Language header.
	SetEnvIf Cookie "site_language=(.+)" prefer-language=$1
	Header append Vary cookie

	# Frame-busting headers and other miscellanea.
	Header set X-Frame-Options SAMEORIGIN
	Header set Strict-Transport-Security "max-age=2592000;"

	# Configure negotiation.
	LanguagePriority en it fr de es pt ca
	ForceLanguagePriority Prefer Fallback

	# Search engine.
	ProxyPass /search http://127.0.0.1:3301
	ProxyPassReverse /search http://127.0.0.1:3301

	# Rewrite rules are used to preserve the old links.
	RewriteEngine On

	# Force HTTPS for all URLs, unless you are connecting
	# to the hidden service.
	RewriteCond %{HTTP:X-Forwarded-Proto} !=https
	RewriteCond %{HTTP_HOST} !\.onion$
	RewriteRule ^/(.*)$ https://%{HTTP_HOST}/$1$2 [R,L]

	# Remove the old language prefix from the URLs.
	RewriteRule ^/(it|en|cat|de|es|pt|fr)/(.*)$ /$2 [R=301,L]

	# Remove the man_ prefix from the old howto URLs.
	RewriteRule ^/stuff/man_(.*)$ /docs/$1 [R=301,L]

	# Rewrite URLs that only have a .html extension (no language),
	# because we don't like them and they're ugly.
	RewriteRule ^/(it|en|cat|de|es|pt|fr)/([^.]*)\.html$ /$2 [R=301,L]

</VirtualHost>