Commit a796434f authored by Kristian Klausen's avatar Kristian Klausen 🎉 Committed by Jelle van der Waa
Browse files

archwiki: Implement short URLs

The wiki people has been wanting this for some time[1], so let's
implement it.

This change the url from:
https://wiki.archlinux.org/index.php/Main_page
to:
https://wiki.archlinux.org/title/Main_page

[1] https://wiki.archlinux.org/index.php?title=ArchWiki_talk:Requests&oldid=648459#index.php_in_url_address
parent 00d1e776
......@@ -61,3 +61,12 @@ $wgMemCachedServers = [ "unix://{{ archwiki_memcached_socket }}:0" ];
# security headers
$wgReferrerPolicy = ["no-referrer-when-downgrade"];
$wgEditPageFrameOptions = "DENY";
## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs
## (like /w/index.php/Page_title to /wiki/Page_title) please see:
## https://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "";
$wgArticlePath = "/title/$1";
$wgUsePathInfo = true;
......@@ -52,6 +52,11 @@ server {
deny all;
}
# Redirect old URLs to the new short-url (/title/<page>)
location ~ ^/index.php/(.*)$ {
return 307 /title/$1;
}
# special case due to our '/index.php/Main_Page' type URLs
location ~ ^/(?:index|redirect)\.php(?:/.*)$ {
access_log /var/log/nginx/{{ archwiki_domain }}/access.log main;
......@@ -86,6 +91,11 @@ server {
add_header X-Cache $upstream_cache_status;
}
# Handling for the article path (pretty URLs)
location ^~ /title/ {
rewrite ^ /index.php;
}
# normal PHP FastCGI handler
location ~ ^/[^/]+\.php$ {
access_log /var/log/nginx/{{ archwiki_domain }}/access.log main;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment