I need to redirect image files to their parent directory with .htaccess. I'm trying to prevent direct access to images for a membership site. I don't care if someone can save the file. I just need to block direct access to images so I can use PHP to display a preview image to non-members instead of the full image that members will be able to access. For example, if someone accesses this URL:
I want to redirect the visitor to:
Note that 'folder' could be any path with varying levels of subdirectories, so I need this to work for any URL if possible and also allow the image to be displayed on a web page. Standard hotlink protection won't really work for this situation. I've searched for a half hour or so, but haven't been able to find a solution. Everything that comes up is either related to hotlink protection or is irrelevant. Does anyone have any suggestions? Thanks!
Code:
http://example.com/folder/image.gif
I want to redirect the visitor to:
Code:
http://example.com/folder/
Note that 'folder' could be any path with varying levels of subdirectories, so I need this to work for any URL if possible and also allow the image to be displayed on a web page. Standard hotlink protection won't really work for this situation. I've searched for a half hour or so, but haven't been able to find a solution. Everything that comes up is either related to hotlink protection or is irrelevant. Does anyone have any suggestions? Thanks!