Jump to content

Topic on Manual talk:Running MediaWiki on Debian or Ubuntu/Flow

Short URL/Apache for Ubuntu 20.10

1
Gstratt (talkcontribs)

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

  1. $wgScriptPath = "/mediawiki";
  2. $wgArticlePath = "/wiki/$1";
  3. $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.

  1. Enable apache's url rewrite module
    1. sudo a2enmod rewrite
  2. Create a configuration file to include the URL rewrite rules
    1. Create /etc/apache2/conf-available/mediawiki.conf
    2. Add the following contents:
      1. RewriteEngine On
      2. RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/mediawiki/index.php [L]
      3. RewriteRule ^/*$ %{DOCUMENT_ROOT}/mediawiki/index.php [L]
  3. Enable that configuration file
    1. Command sudo a2enconf /etc/apache2/conf-available/mediawiki.conf
  4. Set my default VirtualHosts configuration file to import the mediawiki.conf contents
    1. Edit /etc/apache2/sites-available/000-default.conf
    2. Add 1 line just before </VirtualHost>: Include conf-enabled/mediawiki.conf
  5. Restart apache
    1. systemctl restart apache2
Reply to "Short URL/Apache for Ubuntu 20.10"