Manual:Short URL/wiki/Page title -- DreamHost Shared Hosting

From MediaWiki.org

Jump to: navigation, search
This tutorial is to convert the standard MediaWiki URL to a short URL (with Hosting by DreamHost)
  • From This:   /index.php?title=Main_Page
  • To This:       /Main_Page
For any of the examples below use
  • $wgArticlePath = "/$1";
If you want: [ example.com/Main_Page ]
  • $wgArticlePath = "/wiki/$1";
If you want: [ example.com/wiki/Main_Page ]


Contents

[edit] MediaWiki installed in sub-directory (1 level down from root) "www.yourdomain.com/w/"

Modify the following options in LocalSettings.php
$wgUsePathInfo = true;

$wgScriptPath       = "/w";
$wgScript           = "$wgScriptPath/index.php";
$wgArticlePath      = "/$1";
Create or Modify the .htaccess file in the root directory of www.yourdomain.com to include
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /w/index.php?title=$1 [L,QSA]


[edit] MediaWiki installed in sub-sub-directory (2 levels down from root) "www.yourdomain.com/w/wix/"

Modify the following options in LocalSettings.php
$wgScriptPath       = "/w/wix";
$wgScript           = "$wgScriptPath/index.php";
$wgArticlePath      = "/$1";
Create or Modify the .htaccess file in the root directory of www.yourdomain.com to include
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /w/wix/index.php?title=$1 [L,QSA]


[edit] MediaWiki installed in home-directory (same as root) "www.yourdomain.com/"

Modify the following options in LocalSettings.php
$wgScriptPath       = "";
$wgScript           = "$wgScriptPath/index.php";
$wgArticlePath      = "/$1";
In the ROOT directory of www.yourdomain.com place the following .htaccess file
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php?title=$1 [L,QSA]


[edit] MediaWiki installed in sub-domain (1 level down from root) "wiki.yourdomain.com/"

This is not verified, just suggested by DreamHost
edit: working like a charm!

Modify the following options in LocalSettings.php
$wgScriptPath       = "";
$wgScript           = "$wgScriptPath/index.php";
$wgRedirectScript   = "$wgScriptPath/redirect.php";
$wgArticlePath      = "$wgScriptPath/$1";
In the ROOT directory of wiki.yoursubdomain.com place the following .htaccess file
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/(skins|stylesheets|images|config)/
RewriteCond %{REQUEST_URI} !^/(redirect|texvc|index).php
RewriteRule ^(.*)$ /index.php?title=$1 [L,QSA]

[edit] Questions and Comments

Find my contact at http://onesci.com/User:Bradley_Monakhos

Great, seems like it has worked for two more people! Monakhos 23:24, 19 August 2009 (UTC)