From d352748b416e52cc7174ab6e09f61ef82fa19347 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 19 Apr 2015 17:49:06 +0100 Subject: [PATCH] Redirect mediawiki requests to the primary site name --- cookbooks/mediawiki/templates/default/apache.erb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cookbooks/mediawiki/templates/default/apache.erb b/cookbooks/mediawiki/templates/default/apache.erb index 0bedf2124..7aed4b3e7 100644 --- a/cookbooks/mediawiki/templates/default/apache.erb +++ b/cookbooks/mediawiki/templates/default/apache.erb @@ -28,6 +28,13 @@ php_value upload_max_filesize 70M php_value post_max_size 100M + RewriteCond %{SERVER_NAME} !=<%= @name %> +<% if port == 443 -%> + RewriteRule ^/(.*)$ https://<%= @name %>/$1 [R=permanent] +<% else -%> + RewriteRule ^/(.*)$ http://<%= @name %>/$1 [R=permanent] +<% end -%> + RedirectMatch 301 ^/$ /wiki/Main_Page #Historical Compatibility Links -- 2.43.2