Purpose: So let’s say that you have got your Linux based MediaWiki server going on your internal LAN in your office or corporate intranet. Let’s assume that your intranet is Windows server based which basically means that all the files that you access in your day-to-day work resides on Windows based server. Now one of the common requirement is that when you start creating wiki pages you want to link files that resides on your Windows server on LAN or office intranet. How do you do that?
Let’s get started…
Step 1: Set-up
Let’s say you are using a Windows XP machine on your LAN and you usually access files through Mapped network drivers. For for example, let’s say the there is file that you want to link in your MediaWiki page that you normally access as:
from your Windows XP machine. Basically the above file (howtoconfig.pdf) resides on some Windows server on your LAN whose driver is mapped as “N” drive on your machine.
Step 2: Enable “file” protocol
Basically if you want to access files from other servers on your LAN (like Windows shares), you can access them using “file” URL protocol. By default MediaWiki does not enable file link protocol. To enable the file protocol make sure you have the following line(s) in your LocalSettings.php
# nano /etc/mediawiki/LocalSettings.php
and add add the following line(s):
$wgUrlProtocols = array(
'telnet://', // Well if we're going to support the above.. -var
'nntp://', // @bug 3808 RFC 1738
As you can see we the line which says “file”.
Step 3: How to link the file
Now with “file” protocol enable, you can link the file like this in your MediaWiki page like this:
Save the wiki page and now you can see a hyperlink to your document.
Step 4: Linking files that are not mapped to a network drive
So let’s say another file resides on one of the Windows shares whose path is like this:
To link the above file in your Wiki page, do this:
You will notice that the above will work just fine on Internet Explorer. However if you are using FireFox, nothing will happen when you click those links that you just created. The reason is that FireFox by default turns off the “file” protocol for security reasons. You will need to enable that in FireFox. At the time of this writing I am not sure how to do that. Once I find the solution I will make sure to post it. In case if anyone of you figure this out, I would appreciate if you post the procedure in the comment section below.
That’s it! It’s that simple.