I need the assistance of an Apache guru to get a mod_rewrite rule setup right. I've read around and scanned some tutorials, and am now clinically insane. I'm also terrified of breaking the whole thing. I have a series of folders full of images; [url]http://www.example.com/gallery/001/image_01.jpg[/url] [url]http://www.example.com/gallery/001/thimage_01.jpg[/url] [url]http://www.example.com/gallery/002/image_01.jpg[/url] [url]http://www.example.com/gallery/002/thimage_01.jpg[/url] Code (markup): and I want to rewrite them to an imageviewer so when people click the direct link to that image, they see the image, along with an advert (or 2). I've got the imageveiwer setup tested and working, as follows; [url]http://www.example.com/gallery/imageviewer.php?img=001/image_01.jpg[/url] Code (markup): Now the mod_rewrite that's giving me headaches. Here's what I have so far, and a few questions. I'd be very grateful of any help. RewriteEngine on # Check to see if they're a thumbnail? All thumbs are prefixed th RewriteCond %{REQUEST_URI} !th\. [NC] # Rewrite to the imageviewer? RewriteRule ^gallery/(([^.]+)\.jpe?g)$ /gallery/imageviewer.php?file=$1 [NC,L] Code (markup): 1. Do I need to worry about the thumbnails? I don't want the way they're displayed to change, they are only called in standard html, so I don't want them to be affected. 2. Did I deal properly with the number that appears in the URL /001/, /002/, /003/? I think not. 3. I need to put this in httpd.conf. Is that a problem? 4. If you read this far... is it ok? I can't just throw it on the site, as there are thousands of people using it. Thank you in advance. kma
Even if someone could point me to an image specific mod-rewrite that would be great, I'm happy to read up. I've Google'd but the search terms are a bit abmiguous, and I get a lot of results for people wanting to block image hotlinking in httpd.conf. Cheers