|Site customization: $wgUrlProtocols|
|Defines the protocols which are supported and translated in HTML by the mediawiki parser.
|Introduced in version:||1.5.0 (r10229)|
|Removed in version:||still in use|
|Allowed values:||array of strings
string containing a regular expression before 1.6.0
|Default value:||(see below)|
Defines the URL protocols that MediaWiki will recognize. This is used in lots of places. The most visible effect is it determines what protocols are allowed for external links: unrecognized protocols are ignored, no link is generated. However, it's used in many other places too, including the code for Special:LinkSearch, and utility functions like
wfParseUrl() that are used in a wide variety of different places.
Some examples that don't work (because
"test://" is not defined as a valid protocol):
- [test://www.example.com link text]
Note: some browsers, like Mozilla Firefox, will not follow file URLs on pages that have been loaded via HTTP. This is a security measure. See this mozillaZine article for more information, including some hints on how to overcome this restriction.
Note: most browsers do not support "remote file" URLs like file://host/share (only Internet Explorer handles these per default. For Firefox, a plugin is required or use exactly 5 slashes like file://///host/share, see )
|Warning:||In MediaWiki 1.20.2+, adding
Modification (MW 1.6+) 
|MediaWiki version:||≥ 1.6|
To allow links to local files (which may make sense in an intranet context), put this into your LocalSettings.php:
$wgUrlProtocols = "file://";
Similarly, to allow links to SSH server just add the following line to your LocalSettings.php:
$wgUrlProtocols = "ssh://";
Usually you only want to add protocols to this array. The default protocols should all be safe to click on (no evil side effects), and removing a protocol from the list will cause URLs using those protocols to become unrecognized in many places throughout the software. In particular, removing 'http://' or other common protocols will probably break huge amounts of stuff.
The default value has changed in MediaWiki 1.6.0, before that version the following were not recognized by default:
The default value in MediaWiki 1.20.0 is
$wgUrlProtocols = array( 'http://', 'https://', 'ftp://', 'irc://', 'ircs://', // @bug 28503 'gopher://', 'telnet://', // Well if we're going to support the above.. -ævar 'nntp://', // @bug 3808 RFC 1738 'worldwind://', 'mailto:', 'news:', 'svn://', 'git://', 'mms://', '//', // for protocol-relative URLs );
Modification (MW 1.5) 
In earlier versions the setting was a regexp expression which matched the beginning part of the URI; in other words, it is a set of prefixes separated by '|' (with '/' converted to '\/' because '/' has a special meaning in a regular expression.
$wgUrlProtocols = 'http:\/\/|https:\/\/|ftp:\/\/|irc:\/\/|gopher:\/\/|news:|mailto:';
This default value causes MediaWiki to render URIs with the following prefixes as external links:
Older versions 
If you need this functionality in older versions, there is the function
replaceExternalLinks in ./includes/Parser.php. Just add a line for your protocol there.
See also 
|Language:||English • français • 日本語 • 한국어|