I'm the anonymous user. I've remembered my user/pass.
For those running debian 10 (probably Ubuntu too) with root access and apache2 do all of this as root:
1. You need to ensure the rewrite module is loaded in apache2 by doing this:
Type:
a2enmod
then when prompted type
rewrite
then press <enter>
2. Next, edit /etc/apache2/sites-available/000-default.conf by typing
nano /etc/apache2/sites-available/000-default.conf
(or your favourite editor like vi instead)
Immediately before the closing </VirtualHost> tag insert three lines that read:
RewriteEngine On
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/index.php [L]
RewriteRule ^/*$ %{DOCUMENT_ROOT}/index.php [L]
This assumes that your mediawiki installation is in the same directory that apache2 is treating as the document root. The document root path is shown in the file you have open. If your index.php file is in that directory then this will work. This will be the case if your URLs are http://mywiki.com/index.php If your URLs look like http://mywiki.com/somefolder/index.php then you will need to modify the above lines to look like this:
RewriteEngine On
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/somefolder/index.php [L]
RewriteRule ^/*$ %{DOCUMENT_ROOT}/somefolder/index.php [L]
Save the file
3. restart apache2 by typing:
systemctl restart apache2
If it won't restart you've done something wrong which you need to troubleshoot.
4. Next edit LocalSettings.php by typing
nano /var/www/html/LocalSettings.php
(or whatever path you are using)
Look for the text $wgScriptPath (which will probably be near the top)
As above, if your installation is directly in document root, this will probably read $wgScriptPath = ""; in which case, leave it alone. If you are in a subdirectory like above, it will read something different. Leave it alone anyway.
Add this line under it:
$wgArticlePath = "/wiki/$1";
Save the file.
Done.