How to link files on network to MediaWiki

Well, here I am again with update on [easyazon_link identifier=”1847196047″ locale=”US” tag=”wn0d5-20″] MediaWiki [/easyazon_link] that I have installed and configured on GNU Linux Debian server ( see earlier posts) with [easyazon_link identifier=”1514780615″ locale=”US” tag=”wn0d5-20″] Active Directory [/easyazon_link] authentication to MS Small Business Server 2008. Now as we are progressing in use of he MediaWiki we needed to be able to create links to files or folders that are residing on the servers. In order to be able to create the link and be able to use the link to access the file or folder you need to add this to your LocalSettings.php file.

I have simply copied and pastes this into my LocalSetitngs.php file, exactly at the end of the file and saved it and restarted Apache.

# File Link Protocols configuration
$wgUrlProtocols = array(
'http://',
'https://',
'ftp://',
'irc://',
'gopher://',
'telnet://', // Well if we're going to support the above.. -var
'nntp://', // @bug 3808 RFC 1738
'worldwind://',
'mailto:',
'file://',
'news:'
);

Once you have restarted the Apache server you can start using the link protocol to setup links to your files or folders on network. For example, I would like to include a shortcut to network schema document ( SchemaLAN.pdf) that is residing on my SBS server in IT folder. I would type in my MediaWiki text  this:

[file://\SBSITSchemaLAN.pdf]

This will create the “hot” link to the file in [easyazon_link identifier=”1904811590″ locale=”US” tag=”wn0d5-20″] MediaWiki [/easyazon_link] text.

Note: You will notice that the above will work just fine in Internet Explorer. However if you are using FireFox, Chrome or Opera nothing will happen when you click those links that you just created. The reason is that these browsers by default turn off the “file” protocol for security reasons. So far I have found just few notes that this is possible to enable in Firefox by editing the user.pref file for your profile. I will write next post on how and where to do this once I test out my configuration.

Recommended reading:

[easyazon_image align=”none” height=”160″ identifier=”0596519796″ locale=”US” src=”http://blog.technotesdesk.com/wp-content/uploads/2015/11/51LKkJAd89L._SL160_.jpg” tag=”wn0d5-20″ width=”107″]

UPDATE: I was able to locate the Mozilla Firefox KB article that describes the issue to access local links from the browser and how to go around it to enable the access. Here is the KB. Here is what I have done in order to be able to access the links from MediaWiki in Firefox browser:

Note: my MediaWiki sits on mediaserver server

user_pref("capability.policy.policynames", "localfilelinks");
user_pref("capability.policy.localfilelinks.sites","http://mediaserver");
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");

Once this is done, you will be able to access the links from Firefox browser. I do not know how to change it for other browsers and it seems to be pain to change for every user on the network 🙁

4 Replies to “How to link files on network to MediaWiki”

  1. So I am able to link to my local drive but the link looks like [1]. How can I change the link so that it is readable? In MediaWiki, they have pipe links, like [[Main Page|different tex]] and I would have a link that says “different text” and points to the Main Page.

    I tried to this, [file://H:doctest.pdf|different text] and everything else under the sun but it still does not work. Any help or suggestions would be greatly appreciated.

    tks

  2. No it doesn’t work. When I pipe in the text so the link is supposedly readable, for some reason, it would concat %57C onto it. So if I have this, [file://H:doctest.pdf|TEXT] so the link will end up being H:doctest.pdf%57C. Checked Google and I still have no idea what %57C is or why it is being concat onto my link.

  3. Just figured it out. For anyone else having this problem, here’s the solution.
    So if you have this [file://H:doctest.pdf|TEXT] but it will not work. Just replace the pipe with a space and should work now.

    [file://H:doctest.pdf TEXT] The word TEXT will link to the file on my H: drive.

Leave a Reply