Extension:Enforce Correct Virtual Host

Why is this extension needed?
One single wiki may be reachable with different URLs, e.g.
 * http://wiki.myorg.org/index.php
 * http://69.124.251.206/index.php
 * http://wiki/index.php
 * http://localhost/index.php

This will create two types of problems:
 * External links will not be unique and not valid from all environments. E.g.  http://localhost/index.php  will not be reachable from other computers.
 * Using interwiki links to same system will force users to log on again: Take a wiki with articles in German and English. Namespaces en and de have been defined in table interwiki to point to the wiki itself. If the server part of the url changes when following an interwiki link (to the same wiki but different language) the logon is lost as the session cookie is only valid for one server name.

What does this extension?
A default servername is defined. Requests with other servernames are redirected to default server name.

As users will always use the same server name the problems described above are solved.

How to install this extension

 * Copy the script below to /extensions/xyEnforceVirtualHost.php.
 * Change file LocalSettings.php, eg:

Tested environments
The extension has been successfully tested in the following environments:
 * Linux
 * MediaWiki 1.5.8
 * Apache/2.0.50 (Fedora)
 * PHP 4.3.8
 * MySQL 3.23.58
 * Windows 2000 prof
 * MediaWiki 1.8 alpha rev. 15483
 * Apache 2.0.49
 * PHP Version 5.1.1
 * MySQL - 5.0.23-community-nt