Manual:Short URL/wiki/Page title -- with aliases--root access

From MediaWiki.org

Jump to: navigation, search

[edit] Using aliases in httpd.conf

This is the preferred method from a performance point of view, but requires access to edit httpd.conf. Most shared hosting systems do not allow changes to httpd.conf.

The method below has been tested successfully with MediaWiki 1.4.4.

1. In LocalSettings.php, make sure you are using these default values:

$wgScriptPath = "/w";
$wgScript = "$wgScriptPath/index.php";

If you put the wiki installation in a subdirectory such as /w, use $wgScriptPath = "/w" as appropriate.

If you put the files (such as index.php) in the root, you can use $wgScriptPath = "" in LocalSettings.php.

2. In LocalSettings.php, set the following:

$wgArticlePath = "/wiki/$1";

Remember, the virtual directory for the wiki article space should never, ever overlap or hide real files. In particular it should never, ever overlap your base installation directory or the root directory. It can be a virtual subdirectory, such as /wiki. (For example: do not try to rewrite "/wiki/Article" to "/wiki/index.php?title=Article).

3. Set up the following alias in your Apache httpd.conf. It can be in a <VirtualHost> section, or in "Aliases" section, or in your general site config. In this alias, the prefix /filesystem/path/to/my/site represents the path you installed to — the directory where MediaWiki's index.php lives. Replace the prefix as appropriate for your actual file system path.

#These must come last, and in this order!
Alias /wiki "/filesystem/path/to/my/site/index.php"
#Uncomment this if you want / to redirect to /wiki
#Alias /index.php "/filesystem/path/to/my/site/index.php"

For example:

Alias /wiki "c:/apache/www/w/index.php"
#Alias /index.php "c:/apache/www/w/index.php"

After making modifications to httpd.conf, you might have to restart Apache to apply the changes.

Personal tools