Prettify URLs

Closes #5
This commit is contained in:
3wc 2020-09-08 02:09:52 +02:00
parent a6737875ad
commit 6144c3531f
5 changed files with 24 additions and 1 deletions

View File

@ -11,4 +11,5 @@ export MEDIAWIKI_EMAIL_FROM="wiki@wiki.example.com"
export DB_ROOT_PASSWORD_VERSION=v1
export DB_PASSWORD_VERSION=v1
export LOCAL_SETTINGS_CONF_VERSION=v1
export HTACCESS_CONF_VERSION=v1
export ENTRYPOINT_CONF_VERSION=v1

View File

@ -29,6 +29,8 @@ $wgMetaNamespace = "{{ env "MEDIAWIKI_SITENAMESPACE" }}";
## https://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "";
$wgArticlePath = "/wiki/$1";
## The protocol and server name to use in fully-qualified URLs
$wgServer = "https://{{ env "DOMAIN" }}";

View File

@ -37,6 +37,8 @@ services:
configs:
- source: LocalSettings_conf
target: /var/www/html/LocalSettings.php
- source: htaccess_conf
target: /var/www/html/.htaccess
- source: entrypoint2_conf
target: /docker-entrypoint2.sh
mode: 0555
@ -81,7 +83,11 @@ configs:
name: ${STACK_NAME}_local_settings_${LOCAL_SETTINGS_CONF_VERSION}
file: LocalSettings.php.tmpl
template_driver: golang
htaccess_conf:
name: ${STACK_NAME}_htaccess_${HTACCESS_CONF_VERSION}
file: htaccess.tmpl
template_driver: golang
entrypoint2_conf:
name: ${STACK_NAME}_entrypoint2_${ENTRYPOINT_CONF_VERSION}
file: entrypoint.sh
file: entrypoint.sh.tmpl
template_driver: golang

View File

@ -20,6 +20,8 @@ init_db() {
main() {
set -eu
a2enmod rewrite
init_db
}

12
htaccess.tmpl Normal file
View File

@ -0,0 +1,12 @@
# Generated using https://shorturls.redwerks.org
RewriteEngine On
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/index.php [L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2 [L,QSA,B]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]