# How to add a UNC URL to a MediaWiki page

In a MediaWiki page, I'd like to add an URL to a file on a file server. The path is an UNC one(\\fileserver\project\...\SPECIAL.ext), and I already have tried following "path link":

file:////fileserver/projet/.../SPECIAL.ext


I know this is correct: when I enter this location in the address bar of my internet browser, automatically the file gets downloaded.

However, when I put the following line in a Mediawiki page, it doesn't work:

[file:////fileserver/projet/.../SPECIAL.ext]


Not working simply means that I just see "[file:...]" on the page (apparently Mediawiki does not understand that the square brackets are used for defining an URL. When I remove the square brackets, still no good result, I just see "file:...").

However, there are some URLs inside my wiki (they just start with http://), so I have the impression that my MediaWiki doesn't know that file:// has a similar meaning than http://. How do I configure my MediaWiki for this?

Oh, I prefer solving this issue using a simple configuration, if possible. I'd like to avoid installing extensions.

• It’s not unlikely file: URIs are forbidden entirely.
– Daniel B
Jun 8 at 11:44
• @DanielB: your comment might mean that I need to use another way to create a "download" link on a MediaWiki page. It's important that it is not a link to a file on the MediaWiki server, but on another one. Do you know another way to do this?
– Dominique
Jun 8 at 11:47
• @DanielB: in the meantime I tried using http:// instead of file://. This works, but http:////fileserver/projet gets translated into fileserver/projet instead of \\fileserver\projet, no matter how many slashes I put (2, 4, 6, ...).
– Dominique
Jun 8 at 11:53
• Nobody knows how to put slashes in front of an UNC path for mediawiki? Jun 10 at 13:31

Here's the thing: It won't work for others.

Perhaps you could:

1. Try to provide a link to it on the Internet
2. Upload it with Special:Upload if the .ext file format is supported.

Perhaps that's why MW ignores it.

EDIT: To address recent comments, it's possible that MW is not adapted to file:// at all, though we don't know for sure.

• Your error statement says that links, starting with file:// point to files on your own computer, but in my case, I'm working with a file server, where everybody has access to, but there is no IIS on that machine, so http:// does not work. In a first comment on my question, someone mentioned that file:// URI usage is completely forbidden. Isn't there a way to allow it exceptionally? Jun 15 at 14:08
• That's probably the case since MW isn't adapted to working with file servers. Wikipedia, the first MW wiki, didn't and won't have to deal with such situations. Jun 17 at 6:19

There should be a variable in LocalSettings.php called \$wgUrlProtocols. According to the comment before that variable in DefaultSettings.php, you can add file:// to it. I think that means links to a file server should then work.

• I'm planning to do this, but once I've finished, is there something I need to restart in order to make this work? Jun 28 at 9:24
• I believe that adding this entry turns file:// entries into URLs, which is working fine indeed, but we're not there yet: when I put file:////fileserver or file://\\fileserver I see he wants to go to fileserver (without slashes or backslashes). I also tried replacing the (back)slashes by ´%2f´ or %5c (their ASCII codes), but that didn't help either. Jun 28 at 12:01