[Mediawiki-l] cgi_img_auth.php rewrites in htaccess conflict with short URL's

Douglas Dunn doug at javaspec.org
Thu Feb 21 17:03:30 UTC 2008


I am on a shared server that has PHP installed as CGI (in SuExec mode) 
and trying to implement image authorization (using cgi_img_auth.php 
because PATH_INFO indeed does not work on this server) as discussed at:

http://www.mediawiki.org/wiki/Manual:Image_Authorisation#Apache_Instructions_without_PATH_INFO_with_mod_rewrite

The htaccess rewrites for cgi_img_auth.php are in conflict with short 
URL rewrites (I use exactly that same setup as Wikipedia). Here is the 
code for short URL's (unmodified from MW example and working just fine 
on my site)

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^wiki/(.*)$ w/index.php?title=$1 [PT,L,QSA]
RewriteRule ^wiki/*$ wiki/ [L,QSA]
RewriteRule ^/*$ wiki/ [L,QSA]

Here is the code for cgi_img_auth.php rewrites from the above link 
(using the standard images directory, which for short URL's is typically 
w/images not wiki/images): Before you ask, I was trying the standard 
w/images directory location to isolate the problem, which turned out to 
be this htaccess conflict. Eventually, I want to move the images 
directory out of public_html, which is the whole point of using  image 
authorization.

RewriteRule ^/w/images(.*)$ /w/cgi_img_auth.php/$1 [R]
RewriteRule ^w/cgi_img_auth.php/(.*)$ w/cgi_img_auth.php?path=/$1

I can't help thinking someone else must have resolved this conflict. I 
just don't know this syntax at all. No Unix background, I'm embarrassed 
to say. If someone could help me make these two chucks of htaccess code 
cooperate, I would be very grateful.



More information about the MediaWiki-l mailing list