From d4db5c7d063bb8bbb891f057d9a775ebf3390eaa Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Wed, 28 Nov 2018 13:21:58 -0500 Subject: [PATCH] Add Apache redirects for wiki These redirects allow proper Wikidata Query Service linking, same as implemented on WMF sites. --- .../mediawiki/templates/default/apache.erb | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cookbooks/mediawiki/templates/default/apache.erb b/cookbooks/mediawiki/templates/default/apache.erb index 51a4b1bf0..37977a47f 100644 --- a/cookbooks/mediawiki/templates/default/apache.erb +++ b/cookbooks/mediawiki/templates/default/apache.erb @@ -52,6 +52,26 @@ RedirectMatch 301 ^/api\.php$ /w/api.php RedirectMatch 301 ^/opensearch_desc\.php$ /w/opensearch_desc.php + #Support Wikidata redirects based on Wikimedia's redirects: + # https://github.com/wikimedia/puppet/blob/production/modules/mediawiki/files/apache/sites/wikidata-uris.incl + RedirectMatch 301 ^/entity/statement/([QqPp]\d+).*$ /wiki/Special:EntityData/$1 + RedirectMatch 301 ^/value/(.*)$ /wiki/Special:ListDatatypes + RedirectMatch 301 ^/reference/(.*)$ https://wikidata.org/wiki/Help:Sources + RedirectMatch 301 ^/prop/direct/(.*)$ /wiki/Property:$1 + RedirectMatch 301 ^/prop/direct-normalized/(.*)$ /wiki/Property:$1 + RedirectMatch 301 ^/prop/novalue/(.*)$ /wiki/Property:$1 + RedirectMatch 301 ^/prop/statement/value/(.*)$ /wiki/Property:$1 + RedirectMatch 301 ^/prop/statement/value-normalized/(.*)$ /wiki/Property:$1 + RedirectMatch 301 ^/prop/qualifier/value/(.*)$ /wiki/Property:$1 + RedirectMatch 301 ^/prop/qualifier/value-normalized/(.*)$ /wiki/Property:$1 + RedirectMatch 301 ^/prop/reference/value/(.*)$ /wiki/Property:$1 + RedirectMatch 301 ^/prop/reference/value-normalized/(.*)$ /wiki/Property:$1 + RedirectMatch 301 ^/prop/statement/(.*)$ /wiki/Property:$1 + RedirectMatch 301 ^/prop/qualifier/(.*)$ /wiki/Property:$1 + RedirectMatch 301 ^/prop/reference/(.*)$ /wiki/Property:$1 + RedirectMatch 301 ^/prop/(.*)$ /wiki/Property:$1 + RedirectMatch 301 ^/entity/(.*)$ /wiki/Special:EntityData/$1 + Alias /wiki <%= @directory %>/w/index.php #Support /pagename -> /wiki/pagename -- 2.39.5