Open main menu


domainRedirect.js helps you create redirects from a subject's domain name to its article. For example, should redirect to The New York Times. Normally, you'd have to enter the domain into the search box to check if a redirect exists, then hunt around to find the domain which should redirect, and manually go through each step of creating the redirect. This script makes it simple by automating all that and letting you easily create these kinds of redirects if they need to be.


To install the script, add the following to your common.js page:

importScript('User:Opencooper/domainRedirect.js'); // Backlink: [[User:Opencooper/domainRedirect.js]]


If a redirect already exists, nothing is shown since there isn't anything for you to do. If it finds a possible candidate for a redirect, it will show a message under the title stating "(Possible domain redirect:". If you hover over the link, it will tell you where it got that candidate from. Clicking the link will easily allow you to create the redirect, leading you to a new page that is already pre-filled (see preload) and just has to be submitted.

The candidates are determined in the following order:

  1. The official website property on the page's Wikidata item
  2. From the infobox:
    1. Any link inside of the {{url}} template
    2. The |website= parameter of the infobox
  3. From the external links section:
    1. The first {{official website}}
    2. The first external link with "official" in its label

The third method can especially result in false positives, which is why these are only candidates and the creation of the redirect is up to you. It's also common for subjects to have a official page that isn't a unique domain but just a page on another website. Lastly, it might not always make sense for a specific domain to redirect to the subject, especially if it's not something one would search with. If you want to see whether a domain was failed to be found or already exists as a redirect, you can check your browser's console.


This script and any associated files are licensed under Creative Commons Zero.