i setup a wikimedia instance and caddy is kinda managing all the traffic/forwarding, etc - the thing is that the current configuration (i guess it’s the default one)
uses sth like: www.wiki.example.com/index.php/article_name and i’d like to get it to sth like www.wiki.example.com/wiki/article_name and according to the websites it’s done by redirecting
the website showed some examples for apache or nginx but i have no clue how to get the redirects working in caddy
RewriteEngine On
RewriteRule ^/?mediawiki/wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
RewriteRule ^/mediawiki*$ %{DOCUMENT_ROOT}/w/index.php [L]*
4. Error messages and/or full log output:
5. What I already tried:
I tried to convert it but i have legit no clue how
It would be really nice if you can help me to convert it!
You no longer need this in Caddy v2, since the mere act of using Caddy is enough to agree to the ACME terms of use.
So when you run mediawiki like that with the default container, it’s actually running apache inside of the mediawiki container, and you’re proxying to that.
The mediawiki docker image Docker also has an fpm variant which is basically a variant bundled with php-fpm and no server, so you could use nginx or Caddy to serve PHP that way. This is more complex though, so if you’re not sure what you’re doing, just sticking with the apache variant is good enough.
What you’ll want to do is add an .htaccess file with those rewrite rules as recommended by the sites you found. Here’s another I found:
Basically just make a /var/www/html/.htaccess volume mount with those contents and you should be good to go.
So i created a file in the local directory with the following contents:
# Enable the rewrite engine
RewriteEngine On
# Short url for wiki pages
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
# Redirect to Main Page
RewriteRule ^/*$ %{DOCUMENT_ROOT}/w/index.php [L]