From 673affb70caf35403ad76c8d9abe17330b724f4f Mon Sep 17 00:00:00 2001 From: "max.mehl" Date: Fri, 30 Apr 2021 13:14:13 +0200 Subject: [PATCH] rewrite www-subdomain to non-www --- publiccode.eu.conf | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/publiccode.eu.conf b/publiccode.eu.conf index 60683ef..a88d7e4 100644 --- a/publiccode.eu.conf +++ b/publiccode.eu.conf @@ -1,13 +1,28 @@ +# Redirect www subdomain to non-www + + RewriteEngine On + + # Get protocol + RewriteCond %{HTTPS} =on + RewriteRule ^(.*)$ - [env=proto:https] + RewriteCond %{HTTPS} !=on + RewriteRule ^(.*)$ - [env=proto:http] + + # Rewrite to proto://www-less-host/location + RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] + RewriteRule ^(.*)$ %{ENV:proto}://%1$1 [R=301,L] + + +# The normal virtual host for this specific site ServerName publiccode.eu ServerAdmin contact@fsfe.org DocumentRoot /app - - Options FollowSymLinks Includes - AllowOverride All - Require all granted - - + + Options FollowSymLinks Includes + AllowOverride All + Require all granted +