Topic on Project:Support desk

Jump to navigation Jump to search
Knomanii (talkcontribs)

I've followed the tutorial but my Short URL is not working.

My current wiki URL is: example.com/w/index.php?title=Main_Page

My desired URL is: example.com/wiki/Main_Page

I followed MediaWiki's Apache Short URL Guide and ShortURL Builder but /wiki and /wiki/Main_Page are returning 404 Page Not Found.

These recommended settings also resulted in my entire domain being redirected to MediaWiki, which I did not want. It appears this is due to the second RewriteRule below.

What I added to .htaccess (in web root folder, not /w):

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

Added to /w/LocalSettings.php:

$wgScriptPath = "/w";
$wgScriptExtension = ".php";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;

What needs to be changed to get my short url working?

I am using MediaWiki version 1.32.0 with Apache server on shared hosting (no root access).

Thanks in advance for any help.

Knomanii (talkcontribs)

Bump. Was my question not clear enough? Or are there no technical issues the .htaccess rules above?


x-posted to stackoverflow

Ciencia Al Poder (talkcontribs)

If the second RewriteRule is working, it means the first one is also working, but I can't explain why it returns a 404 error.

You may want to look at apache error logs to find the real path being accessed

Reply to "Short URL Help"