A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.mediawiki.org/wiki/Manual:$wgUrlProtocols below:

Manual:$wgUrlProtocols - MediaWiki

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) (1.6+)
(string containing a regular expression) (1.5) Default value: see below

Defines the URL protocols that MediaWiki will recognize as valid in UrlUtils::parse(). 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 UrlUtils::parse() that are used in a wide variety of different places.

These examples would not work (because "test://" is not defined as a valid protocol):

Warning: In MediaWiki 1.20.2+, adding "file:" without trailing slashes to $wgUrlProtocols will break image embedding using the [[File:Image.jpg]] syntax. This is a known bug related to a change that made URL protocol matching case-insensitive. As a workaround, use "file://" instead of "file:" as shown below.

To allow links to local files (which may make sense in an intranet context), put this into your LocalSettings.php :

$wgUrlProtocols[] = "file://";

Usually you only want to add protocols to this array.

$wgUrlProtocols = [
	'bitcoin:', 'ftp://', 'ftps://', 'geo:', 'git://', 'gopher://', 'http://',
	'https://', 'irc://', 'ircs://', 'magnet:', 'mailto:', 'matrix:', 'mms://',
	'news:', 'nntp://', 'redis://', 'sftp://', 'sip:', 'sips:', 'sms:',
	'ssh://', 'svn://', 'tel:', 'telnet://', 'urn:', 'worldwind://', 'xmpp:',
	'//',
];
MediaWiki versions:

1.24 – 1.37

$wgUrlProtocols = [
	'bitcoin:', 'ftp://', 'ftps://', 'geo:', 'git://', 'gopher://', 'http://',
	'https://', 'irc://', 'ircs://', 'magnet:', 'mailto:', 'mms://', 'news:',
	'nntp://', 'redis://', 'sftp://', 'sip:', 'sips:', 'sms:', 'ssh://',
	'svn://', 'tel:', 'telnet://', 'urn:', 'worldwind://', 'xmpp:','slack://', '//', 
];
MediaWiki versions:

1.22 – 1.23

$wgUrlProtocols = array(
	'http://',
	'https://',
	'ftp://',
	'ftps://', // If we allow ftp:// we should allow the secure version.
	'ssh://',
	'sftp://', // SFTP > FTP
	'irc://',
	'ircs://', // @bug 28503
	'xmpp:', // Another open communication protocol
	'sip:',
	'sips:',
	'gopher://',
	'telnet://', // Well if we're going to support the above.. -ævar
	'nntp://', // @bug 3808 RFC 1738
	'worldwind://',
	'mailto:',
	'tel:', // If we can make emails linkable, why not phone numbers?
	'sms:', // Likewise this is standardized too
	'news:',
	'svn://',
	'git://',
	'mms://',
	'bitcoin:', // Even registerProtocolHandler whitelists this along with mailto:
	'magnet:', // No reason to reject torrents over magnet: when they're allowed over http://
	'urn:', // Allow URNs to be used in Microdata/RDFa <link ... href="urn:...">s
	'geo:', // urls define geo locations, they're useful in Microdata/RDFa and for coordinates
	'//', // for protocol-relative URLs
);
MediaWiki versions:

1.18 – 1.21

$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
);
$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:',
	'news:',
	'svn://',
	'git://',
	'mms://',
);
MediaWiki versions:

1.15 – 1.16

$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:',
	'news:',
	'svn://',
);
MediaWiki versions:

1.6 – 1.14

$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:',
	'news:'
);
$wgUrlProtocols = 'http:\/\/|https:\/\/|ftp:\/\/|irc:\/\/|gopher:\/\/|news:|mailto:';
Advanced modification[edit]

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. Nevertheless, if you need to do so (for example, you already have a News: namespace), you can do something like this:

$wgUrlProtocols = array_diff($wgUrlProtocols, array('news:'));

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4