[MediaWiki] Short URLs using AddHandler/SetHandler

apps

#1

I have MediaWiki installed on DreamHost’s shared-hosting environment, and I’m currently using mod_rewrite with the following lines in .htaccess, as the MediaWiki manual instructs:

RewriteEngine On RewriteRule ^/?wiki/(.*)$ /w/index.php?title=$1 [PT,L,QSA] RewriteRule ^/?wiki/*$ /w/index.php [L,QSA] RewriteRule ^/*$ /w/index.php [L,QSA]

I find this to be causing a noticeable hit on speed, likely due to the inherent inefficiency in rewriting. Searching around, I stumbled upon a 2006 post by a user named guice providing an alternative:

I tried what he recommended but wasn’t sure exactly which settings are involved in ‘point your Wiki configs to use www.domain.com/wiki as the URL and tell it to use “pretty” URLs’, and in the end, this method just gave me 404s.

Seeing as I can’t PM or email users on this forum, I can’t get in touch with guice personally, so I’m wondering if anyone here might know what needs to be done to get guice’s more efficient method working.

Curiously, nowhere else on the Web but an even vaguer Chinese site even mentions this method.

My MediaWiki’s installation environment:
MediaWiki installed to /w [yes, I did replace the “wiki_media” in guice’s shell command with “w”]
Hope to use URL format /wiki/<page_name>
LocalSettings.php has the standard:

$wgScriptPath = "/w"; $wgArticlePath = "/wiki/$1";

Thank you!


#2

Yeah, those instructions you’ve picked up from guice are just plain old wrong! Don’t use them.

The mod_rewrite approach that you’ve picked up from the MediaWiki manual should be fine. The overhead from using mod_rewrite is miniscule (a couple milliseconds at worst) — it’s almost certainly not what’s holding you back.


#3

Ah, thank you very much, andrewf! That’s good to know. And now I can search elsewhere for the bottleneck :slight_smile: