Skip to content
Snippets Groups Projects
Commit a796434f authored by Kristian Klausen's avatar Kristian Klausen :tada: Committed by Jelle van der Waa
Browse files

archwiki: Implement short URLs

parent 00d1e776
No related branches found
No related tags found
1 merge request!335archwiki: Implement short URLs
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment