Htaccess image to page?

software development

#1

Hello,

I’m wondering how to do this, I’ve seen it done before, but wasn’t sure of how to achieve it, though I do think it’s done with htaccess.

How would I go about making it where if someone accesses an image on my website for example: mydomain.com/image.ext – It would then redirect to a page html/php with the same exact image as they were directed to. Now, images would be random, so it wouldn’t be a static image visitors would go to, I’m talking about any image in a certain directory that would be accessed by a visitor.

Thanks if someone can answer this… :slight_smile:


#2

Try this in a htaccess file:
RewriteRule ^([A-Za-z0-9-]+).(jpg|gif)$ new_page.php [R,L]

Now you should beable to write a php program to access the images randomly.
Hope this helps,
Silk

My website