The Apache .htaccess tutorial didn't work for me (Apache 2.4). It gave me a default Apache 404 page. Probably because I have $wgScriptPath = ""
. Adding Options -MultiViews
to .htaccess didn't help. After lots of experimenting I finally made it working like this:
RewriteEngine on
RewriteBase /images
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /thumb.php?f=$1&width=$2 [L,QSA,B]
Maybe this will help someone as well. The key line here is RewriteBase /images
.