Topic on Project:Support desk

[RESOLVED] Removing indexdotphp from the URL?

7
79.136.64.84 (talkcontribs)

Hey.

Wikipedia articles has the URL "[servername, in this case wikipedia]/wiki/[article]".

Meanwhile, articles on my own wiki has the URL "[servername]/wiki/index.php/[article]"

Why is this, and can I change it to be like wikipedia?

Florianschmidtwelzow (talkcontribs)

All you want to know about this is documented here.

79.136.64.84 (talkcontribs)

Thanks a lot!

First attempt failed, but I'm sure I'm on the right path.

My service provider uses an Apache/LiteSpeed server.

I used the wizard linked from the guide. Created .htaccess and added to localsettings.php

"/wiki/.htaccess"
RewriteEngine On
RewriteRule ^/?wiki/wiki(/.*)?$ %{DOCUMENT_ROOT}/wiki/index.php [L]

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

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

"/wiki/LocalSettings.php"
## 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 please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "/wiki";
$wgScriptExtension = ".php";
$wgArticlePath = "{$wgScriptPath}/wiki/$1";
$wgUsePathInfo = true;

The problem now is twofold:

  • 1. The page links are changed not from "/wiki/index.php/Page_name" to "/wiki/Page_name", but instead to "/wiki/wiki/Page_name"
  • 2. Both "/wiki/wiki/Page_name" and "/wiki/Page_name" gives an error message, "resource not found". So I can't add a page there. However, I can still access the page by manually changing the url to "/wiki/index.php/Page_name".
79.136.64.84 (talkcontribs)

This has been resolved, got help on the IRC channel. had to rename the folder, move the htaccess to root, and change some links to the new folder.

Florianschmidtwelzow (talkcontribs)

Great :) Are you sure you want to have domain.tld/wiki/wiki/Article or domain.tld/wiki/Article? :)

79.136.64.84 (talkcontribs)

Haha, yeah, removing the double "wiki" was one of the changes I had to make!
I have no idea why the wizard suggested "RewriteRule ^/?wiki/wiki(/.*)" instead of "RewriteRule ^/?wiki(/.*)".

Reply to "[RESOLVED] Removing indexdotphp from the URL?"