Manual:Short URL overview


 * Note: The original Manual:Short URL has become so complex I cannot clean it up. So I started the below Short URL overview with no how tos on this page but instead separate pages for Short URL solutions, linked below as subpages of Manual:Short URL. Eventually this Manual:Short URL overview may be moved to Manual:Short URL. Welcome to help! :-) --Rogerhc 06:42, 3 September 2007 (UTC)

Overview of how to configure short webpage addresses (URLs) in MediaWiki

According to World Wide Web inventor Al Gore Tim Berners-Lee, good webpage addresses should never change. Short webpage addresses which hide complex programming code from the webpage address bar is good for webpage visitors.

MediaWiki does not have short webpage addresses normally because short webpage addresses have to work with server instructions that are different and vary from the specific server and hosting account the mediawiki webpage is using.

As of Mediawiki version 1.11.0, MediaWiki's default webpage addresses (URLs) are similar too this example:
 * or

Using the methods below, short webpage addresses can be changed to addresses such as these:

How to shorten a webpage addresses gets complicated fast. So "how tos" will be on separate pages listed below.

Root access or no root access?
Shared Hosting: If you are using shared hosting it is unlikely you will have root access to the server. You probably will not be able to use any of the root access techniques below. Start by opening a ticket with your hosting provider. Ask the provider how to get rid of the "index.php?title=" for all pages and your hosting provider may well solve your problem for you.

The methods below with "no root access" in the name assume that you don't have access to the server configuration (for example, if you're on a shared host); if you do have root access see, see 'Manual:Short URL'.

The .htaccess can be rewritten without root access. Editing httpd.conf is the preferred method because your wiki performs better. But editing httpd.conf requires root access. Most shared hosting systems do not allow changes to httpd.conf.

Depending on your host, you may be able to use an alias or a rewrite rule in an .htaccess file. Do not try to edit both httpd and .htaccess at once. Only one is needed.

Short URL how tos
Anyone is welcome to create a "how to" solution page and list them below. Please use a sensible name for the page, one that fits in with the below names. When each unique solution has its own page, readers can skip complexity they do not want.

Keep it simple, readable, short, with a separate page per separate solution.

Example.com/Page_title
How to create: example.com/Page_title webpage addresses
 * Manual:Short URL/Page title -- EASY
 * Manual:Short URL/Page title -- PHP as a CGI module, no root access [[Image:Face-sad.svg|20px]]
 * Manual:Short URL/Page title -- solution xxx
 * Manual:Short URL/Page title -- solution yyy
 * Manual:Short URL/Page title -- solution zzz

Example.com/wiki/Page_title
How to create: example.com/wiki/Page_title webpage addresses


 * Manual:Short URL/wiki/Page title -- PHP as a CGI module, no root access [[Image:Csmile alt.svg|20px]][[Image:Face-sad.svg|20px]] [[Image:Csmile alt.svg|20px]]
 * Manual:Short URL/wiki/Page title -- no root access [[Image:Face-sad.svg|20px]]
 * Manual:Short URL/wiki/Page title -- solution xxx, no root access
 * Manual:Short URL/wiki/Page title -- solution yyy, no root access
 * Manual:Short URL/wiki/Page title -- solution zzz, no root access

Root access These methods require that you have access to the server configuration. If you are on a shared host, you most likely don't; see the "no root access" examples instead.


 * Manual:Short URL/wiki/Page title--root access -- EASY
 * Manual:Short URL/wiki/Page title -- with aliases--root access
 * Manual:Short URL/wiki/Page title -- Apache rewrite--root access If the Alias method is not suitable (for example, you use PHP as a CGI), you can use Apache instead.
 * Manual:Short URL/wiki/Page title -- Lighttpd rewrite--root access
 * Manual:Short URL/wiki/Page title -- solution yyy---root access
 * Manual:Short URL/wiki/Page title -- solution zzz---root access

Wiki.example.com/Page_title
How to create: wiki.example.com/Page_title webpage addresses
 * Manual:Short URL/wiki.example.com/Page_title -- EASY ?
 * Manual:Short URL/wiki.example.com/Page_title--difficult
 * Manual:Short URL/wiki.example.com/Page_title--Subdomain with no Subdirectory in Article URL
 * Manual:Short URL/wiki.example.com/Page_title--solution xxx
 * Manual:Short URL/wiki.example.com/Page_title--solution yyy

Ampersand (&) problem

 * Manual:Short URL/Ampersand solution with root access
 * Manual:Short URL/Ampersand semi-friendly solution with root access
 * Manual:Short URL/Ampersand --solution xxx
 * Manual:Short URL/Ampersand --solution yyy


 * Explanation: This problem shows up when you have page titles with symbols in (such as &, ?, #, + and /) that, despite being correctly encoded in the link are not being passed correctly from mod_rewrite to the script. This manifests in 404 page not found errors, because the title gets cut off at the special character. e.g. Clicking on a link "John & Maria's page" gets a 404, because MediaWiki is looking for a page names "John ".


 * Reason for the problem: The reason for the Ampersand problem is that using the long form means that articles can't have ampersands in their name because they would be treated as query string separators and would never reach the PHP runtime environment. The cause of the is Ampersands problem is an old and problemic mod_rewrite bug. There are discussions of other possible solutions at lists.wikimedia.org and fgiasson.com.