Template:Get hostname
From WikiApiary, monitoring the MediaWiki universe
This template returns the hostname for a given URL.
Examples:
- http://www.google.com/ = www.google.com
- http://www.google.com = www.google.com
- HTTP://WWW.GOOGLE.COM = www.google.com
- http://wiki.minnestar.org/w/index.php?title=Template:Get_hostname&action=edit = wiki.minnestar.org
- http://www.youtube.com/watch?v=NA9F357Q4KU&list=PLItWkVuyxHmVWdCnBXDFgPMA5o5eEkjTQ = www.youtube.com
- https://www.youtube.com/watch?v=NA9F357Q4KU&list=PLItWkVuyxHmVWdCnBXDFgPMA5o5eEkjTQ = www.youtube.com
This template will take either the first argument, or a named parameter called URL. Note that if you pass it a URL with an equals sign you must use the named parameter. For safety, it would be recommended to always use the named parameter. Also beware that a pipe character will cause problems in the template call so you should check for a pipe in the URL before calling this template.