Thread:Project:Support desk/Image Authorization not working in Mediawiki 1.20.2

I have the latest version of Mediawiki (1.20.2) installed on a bluehost shared server. I did what was given at Manual:Image_Authorization:

1. Downloaded this file  and put it in public_html/w/images folder.

2. Added the line "Deny from All" to the .htaccess file that came with installation in the folder public_html/w/images.

3. Added $wgUploadPath = "/wiki/cgi_img_auth.php"; in public_html/w/LocalSettings.php. Also tried the line $wgUploadPath = "cgi_img_auth.php" as suggested by someone on the discussion page.

4. Added following lines in public_html/w/images/.htaccess:


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


 * 
 * Options -Indexes
 * 

Public listing of images directory is gone (throws 500 server error when w/images is accessed directly through browser) but all the images on all the pages are broken. Uploading works fine; it does upload the images into images directory though. Tried adding the above lines in public_html/.htaccess too, but that breaks the whole thing - throws an internal server error when I try to access any page. Are there any simple/standard/clearer steps or an extension to achieve this?