Because I am an *absolute* noob when it comes to both apache and Ubuntu, it took me a while to get Short/Pretty URLs working in Apache on Ubuntu 20.10. The settings below are an expansion to Manual:Running MediaWiki on Debian or Ubuntu#Pretty URLs
Update LocalSettings.php
$wgScriptPath = "/mediawiki";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;
Add URL Rewrites to Apache
The Debian (Ubuntu) Apache package splits all the configuration files into various folders. Rather than adding the rewrite rules directly into the default Virtual Hosts .conf file, I created a separate .conf and linked the two with an Include. I'm not sure this is *exactly* how Debian intends this to be configured, but it did work.
- Enable apache's url rewrite module
sudo a2enmod rewrite
- Create a configuration file to include the URL rewrite rules
- Create
/etc/apache2/conf-available/mediawiki.conf
- Add the following contents:
RewriteEngine On
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/mediawiki/index.php [L]
RewriteRule ^/*$ %{DOCUMENT_ROOT}/mediawiki/index.php [L]
- Create
- Enable that configuration file
- Command
sudo a2enconf /etc/apache2/conf-available/mediawiki.conf
- Command
- Set my default VirtualHosts configuration file to import the
mediawiki.conf
contents- Edit
/etc/apache2/sites-available/000-default.conf
- Add 1 line just before </VirtualHost>:
Include conf-enabled/mediawiki.conf
- Edit
- Restart apache
systemctl restart apache2