Short URLs in MediaWiki on a localhost: Difference between revisions

From Cor ad Cor
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 1: Line 1:
In my local installation of MediaWiki, the scripts are in <''C:\wamp\www\mediawiki''>.
In my local installation of MediaWiki, the scripts are in <''C:\wamp\www\mediawiki''>.


I want the short URL to be <''http://localhost/wiki''>, followed by page names.
I am using WampServer 3 (x64), but I imagine that the same principles would work on other versions.
 
I wanted the short URL to be <''http://localhost/wiki''>, followed by page names.
 
This is what worked for me:


; In httpd.conf
; In httpd.conf
Line 24: Line 28:
</pre>
</pre>


; This .htaccess may not be strictly necessary, but it doesn't hurt.
; This .htaccess may not be strictly necessary, but it doesn't seem to hurt.
<pre>
<pre>
## http://www.mediawiki.org/wiki/Manual:Short_URL/Apache
## http://www.mediawiki.org/wiki/Manual:Short_URL/Apache

Latest revision as of 09:22, 30 December 2016

In my local installation of MediaWiki, the scripts are in <C:\wamp\www\mediawiki>.

I am using WampServer 3 (x64), but I imagine that the same principles would work on other versions.

I wanted the short URL to be <http://localhost/wiki>, followed by page names.

This is what worked for me:

In httpd.conf
alias /wiki /wamp/www/mediawiki/index.php

<Directory "/wamp/www/mediwiki">
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
In LocalSettings.php
## Base path to the directory containing the wiki;
## Cf. http://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath       = "/mediawiki";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;
This .htaccess may not be strictly necessary, but it doesn't seem to hurt.
## http://www.mediawiki.org/wiki/Manual:Short_URL/Apache

# Enable the rewrite engine
RewriteEngine On

# Redirect / to Main Page
RewriteRule ^/*$ %{DOCUMENT_ROOT}/mediawiki/index.php [L]

Links