phpapachemediawikishort-url

Mediawiki - set homepage to not show the page/article name in the URL


Just starting to learn the world of MediaWiki.

I have managed to setup my article paths using the ShortURL guide. How can I setup my homepage so it is just my domain page aka help.pearldentalsoftware.com and not include the /w/Main_Page?

This is my LocalSettings.php:

$wgMetaNamespace = "Pearl_Dental_Software_Wiki";

## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs
## (like /w/index.php/Page_title to /wiki/Page_title) please see:
## https://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "";
$wgScript = "{$wgScriptPath}/";
$wgArticlePath = "/w/$1";
$wgUsePathInfo = true;

## The protocol and server name to use in fully-qualified URLs
$wgServer = "https://help.pearldentalsoftware.com";
## The URL path to static resources (images, scripts, etc.)
$wgResourceBasePath = $wgScriptPath;

and my .htaccess

RewriteEngine On
RewriteRule ^/?w(/.*)?$ %{DOCUMENT_ROOT}/ [L]

RewriteCond %{HTTP_USER_AGENT} !^(VisualEditor)
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?images/thumb/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2 [L,QSA,B]

RewriteCond %{HTTP_USER_AGENT} !^(VisualEditor)
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?images/thumb/archive/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]

Solution

  • There is a mediawiki setting to set the main page as the domain root

    $wgMainPageIsDomainRoot = true;
    

    For this to take effect, I think you may also have to set your article path to not have the prefix, but I'm not entirely certain.

    for example:

    $wgArticlePath = $wgScriptPath . '/$1';