Tech/HowTo/Mediawiki Short URLs
Jump to navigation
Jump to search
Apache HTTTPD
Apache HTTPD has a module for rewrite that might not be enabled. Here is an example on Debian where Apache HTTPD is called Apache2
Module
root@system:/# a2query -m rewrite No module matches rewrite root@system:/# a2enmod rewrite Enabling module rewrite. To activate the new configuration, you need to run: systemctl restart apache2 root@system:/# systemctl restart apache2
Overrides aka .htaccess
- /etc/apache2/apache2.conf
<Directory /var/www/> Options Indexes FollowSymLinks # AllowOverride None AllowOverride All Require all granted </Directory>
- This could be a bit tighter scoped but just trying to get the idea across
Files
If you want clean urls from the document root of your install for a full domain make these changes or settings. assuming that rewrite engine is working in Apache
.htaccess
RewriteEngine On RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/index.php [L]
LocalSettings.php
$wgScriptPath = ""; $wgArticlePath = "/$1";