Domains and DNS

From mw.mh370.wiki
Jump to navigation Jump to search


A Guide to Using MediaWiki in a Hosted Environment

An instructional website by the developer of mh370wiki.net - a MediaWiki site about Malaysia Airlines Flight MH370.


Website Domains, and the Domain Name System (DNS)

When planning a new website there are a number of decisions to make and actions to take:-

  1. Define the purpose of the website and decide on a suitable Site Name.
    The Site Name should be descriptive, may be a phrase, is typically in a page header, and usually matches an organisation or business name.
  2. A domain mame for the website should be related to the Site Name but domain names do not have spaces, although they can include the underscore _ or hyphen - characters.
    To get the name of your choice it may be necessary to consider various top-level domains such as .com, .org, .net and many others (including .wiki) either as the domain extension or in conjunction with a country code such as .uk, .fr, .au etc.
    To get a domain name ending with a country-specific domain extension it will have to be registered in that country.
  3. Select a hosting service provider, where the website will be located.
  4. Decide whether to register the domain name through the website hosting service or through a separate Domain Registrar.
    Most hosting services provide on-line tools to assist with domain name selection and will also register the domain on your behalf.
    But you can use a different domain registrar.
  5. After you set up an account with a website hosting service and log-in you will normally have an interface called cPanel.
    Within cPanel there is a section headed Domains. Here is where you manage domains, the section will list all of your registered domains that are related to websites hosted by this hosting service.
    However, the button labelled Create a New Domain is a bit misleading:- it really means 'create or add a new domain record'. The domain name must be registered before it can be added.
  6. When a domain is added to the list the hosting service will create appropriate DNS entries for you. But if you registered the domain with a different Domain Registrar you will need to add the addresses of your website hosting service DNS server on that account.
    The Domain Name Service is basically a look-up system used throughout the Internet. When a URL is typed into a browser a query is sent to a Domain Name Server to resolve the domain name portion of the URL into an IP Address, which is used by routers to direct the browser request to the web server which actually serves that website.
    If this is your domain and your website then it is your hosting provider's web server which loads your website from your account from the Document Root folder in your /public_html folder.
  7. For a MediaWiki-based website the Document Root folder has a .htaccess file which instructs web server where to get the website content (inside the /w sub-directory) and (usually) to use a short-form of the URL. The web server gets specific instructions from the /w/LocalSettings.php file and the website content is retrieved from the database named in that file.


Example: mh370wiki.net website

The domain name is mh370wiki.net.

The domain names mh370wiki.org and mh370wiki.com are also registered, but redirected to mh370wiki.net.

The website is hosted by a hosting service provider, which also configures the DNS records.

These domain names are registered by a separate domain registry service. The registration includes the addresses for the hosting DNS servers.


Example: this website mw.mh370.wiki

The domain name is mh370.wiki.

However, mw.mh370.wiki is a sub-domain. This is listed in cPanel --> Domains. There can be many sub-domains. The DNS servers only keep entries for the registered domain name and send the traffic to the appropriate web-server. The web server at the hosting provider uses the configuration from cPanel --> Domains to identify where the files for the sub-domain are.

If someone browses to mh370.wiki or www.mh370.wiki they will be redirected to mw.mh370.wiki. The mw is an abbreviation for MediaWiki, so that is appropriate for the site context - it is not a site about flight MH370, it is a site about MediaWiki as used for the website mh370wiki.net.

Domain redirects are also configured through cPanel --> Domains, select the Domain and then Manage.

In LocalSettings.php the setting for $wgSitename 'is the name of the site as displayed throughout the site', and $wgMetaNamespace is 'The name of the meta namespace (also known as the project namespace), used for pages regarding the wiki itself'.

For simplicity, the value of $wgSitename is the domain name as displayed by a web browser in the URL field.

$wgSitename = "mw.mh370.wiki";
$wgMetaNamespace = "mw.mh370.wiki";


Alternate Configurations

It is possible to configure the domains in the list cPanel --> Domains so that several domains point to a single Document Root directory. Then there are two possibilities:-

  • There is a single Localsettings.php file and therefore a specific $wgSitename so regardless of the incoming domain request there is only one website to deliver content.
  • There is a 'Switch' which uses Case statements to send the request in different directions, depending on the incoming domain name request. Each loads a specific LocalSettings.php file.
    But - there could be only one instance of a MediaWiki installation. This is a MediaWiki 'farm' concept. The settings and database for each website are separate but they all use the same MediaWiki installation files.


It is also possible, as a variant of the above, to use the same database. In this case the Switch directs the web server to a LocalSettings.php file for the domain and the value of $wgSitename matches that domain name and the content is served as though that domain is unique.

But if a request for the same page is made for a different but valid domain name then the Switch directs the web server to the LocalSettings.php file for that domain and the end user sees the value of $wgSitename matching that domain in their browser.

Technically this works, but search engines will recognise 'duplicate content' for the websites and downgrade their ranking.


Articles which relate to Domains

Articles which relate to Domains are included in Category:Domains.

The CategoryTree Extension enables a listing of relevant sub-categories and pages:-



Articles which relate to DNS

Articles which relate to DNS are included in Category:DNS.

The CategoryTree Extension enables a listing of relevant sub-categories and pages:-





Links

Manual:$wgSitename
https://www.mediawiki.org/wiki/Manual:$wgSitename
Manual:$wgMetaNamespace
Information about this variable is scant. Usually it is assigned the same value as $wgSitename
https://www.mediawiki.org/wiki/Manual:$wgMetaNamespace