Babbling about stuff
L.E.B.O.
Archives
« November 2009
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
     
       
Today
Click me to subscribe
Search

Links
 

Today's Page Hits: 26

Locations of visitors to this page
« Braiiiiiiiiins..... | Main | Why.... »
Thursday Jan 17, 2008
The trouble with Tribbles... errr.. I mean Wikis

I have been a bit busy lately... fighting with MediaWiki and losing. :-(

One of my tasks right now is to get the OpenOffice.org wiki updated to the latest version of MediaWiki.  I have a staging wiki set up for testing, and have been working my way through the various settings in apache, and in MediaWiki.  Up until recently it has been going fairly well.  Apache is generally not that hard to deal with, and MediaWiki has also been relatively painless... that is until I tried to get the Short URL feature working in MediaWiki.

The default URL for MediaWiki includes index.php, so for example the default URL for the OOo Wiki would look something like this:

http://wiki.services.openoffice.org/wiki/index.php/Main_Page

but with the Short URL feature turned on it looks like this:

http://wiki.services.openoffice.org/wiki/Main_Page 

This is what it works like right now on the existing OOoWiki.  Since the existing OOoWiki install has been using the short URL feature for years now, I must have it enabled on the updated wiki engine as well.

How is it enabled?  There are a bunch of different ways to do it depending on whether you have root access to the server or not.  I have root access, so that is the logical and also the best solution (it's worth noting that I have tried the non-root solutions, and get the same or similar results, mainly the 404 error I mention below).

The simple way to turn on this feature is the same method as is used by Wikipedia, and is documented here: http://www.mediawiki.org/wiki/Manual:Short_URL#Recommended_setup_.28Wikipedia_style.29

The short version is to edit the httpd.conf file and add

Alias /wiki /path/to/index.php

and then edit LocalSettings.php (the MediaWiki config file) and add the line

$wgArticlePath = /wiki/$1;

It should be that simple, but sadly as with many things to do with computers it never really is that simple.

The httpd.conf file already contains these aliases:

Alias /wiki/ "/space/mwiki/" 
ScriptAlias /wiki "/space/mwiki/"

So, I added

Alias /wiki /space/mwiki/index.php

right under the existing two, and added the option to the LocalSettings.php file... restart apache and see what happens.

With all three aliases in the httpd.conf and $wgArticlePath set to /wiki/$1 the wiki then just returns a 404 error

"The requested URL /wiki/Main_Page was not found on this server."

If I comment out the original two aliases (so that the only alias is the new one) and restart apache, and load http://wiki.services.openoffice.org/wiki/Main_Page the main wiki page loads, but the default MediaWiki skin is not loaded.  Hmmm that's not so good.  On top of that, if I try the base URL http://wiki.services.openoffice.org/wiki/ which should load the Main_Page, MediaWiki wants to edit Index.php (note the capital I on the page name).

First issue... the Index.php problem is related to an apparent bug in MediaWiki 1.11.  The fix for this is to add another line to the LocalSettings.php file that looks like this:

$wgUsePathInfo = false; 

If I do that, I send MediaWiki into a redirect loop and am presented with this error:

Internal error

Redirect loop detected!

This means the wiki got confused about what page was requested;
this sometimes happens when moving a wiki to a new server or
changing the server configuration.

Your web server was detected as possibly not supporting URL path
components (PATH_INFO) correctly; check your LocalSettings.php
for a customized $wgArticlePath setting and/or toggle $wgUsePathInfo
to true.

 To "fix" this I either remove the option and then have the problem with the wiki always wanting me to edit Index.php or I disable all of the Short URL changes and I'm back at the start again.

And so it goes... round and round.  If anyone at has a clue about this and knows of something I can do to get this working... or sees my mistake, feel free to leave a comment :-)
Posted at 02:03PM Jan 17, 2008 by cdc in Sun  |  Comments[2]

Comments:

Get in contact with someone who has setup this wiki or who coordinated it's creation (like Stefan Taxhet @ Sun). If you're unsure then contact the dev[at]tools.openoffice.org mailing list. I believe someone will help you.

Posted by Joost Andrae on January 17, 2008 at 02:43 PM CET #

I solved the problems. It came down to a combination of settings that all had to fall into place at the right time in the right order... kind of like that old Mastermind game (the one where you have to guess the order of some hidden colored pegs).

The httpd.conf file has these settings:

Alias /w /space/mwiki
Alias /wiki /space/mwiki/index.php

and the LocalSettings.php file now has these settings:

$wgScriptPath = "/w";
$wgScript = $wgScriptPath/index.php";
$wgArticlePath = "/wiki/$1";
$wgStylePath = "$wgScriptPath/skins";
$wgStyleDirectory = "$IP/skins";

and most importantly... even though all the documentation says you must, do NOT set $wgUsePathInfo = false;. If that variable is set to false, it sends the wiki into a redirect loop and no wiki pages can be loaded.

Using these settings I managed to get the whole ShortURL thing working consistently and reliably on MediaWiki 1.11.

Posted by cdc on January 23, 2008 at 11:26 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed