I'm a new web developer and currently creating a site that contains a user area which includes a photo gallery. I have never had to write a .htaccess file before and I am getting all sorts of lost looking for a solution to my problem:
How I'd like to process to go:
1. A user logs into the site to gain access to the gallery.
2. A user may browser through photos while within the gallery.
What I would
not like to happen:
1. A user types in the direct address to an image
www.any_site.com/images/image.jpg
.
2. The user's browser displays the image.
I believe the .htaccess file is where I should be limiting the access to this file, but I don't know where to start.
Some helpful information about the site:
The site is coded using PHP and XHTML with CSS styling.
The login and session handling works appropriately for restricting actual page access.
I need to be able to display the image (so allow my PHP access to the image and then thus the browser access when called in an
<img>
tag), however I cannot put the images folder above my root directory.
Also, I have no idea where to find a good starting place for learning to write the .htaccess files (syntax, proper functions, etc.).
If anyone can help with this specific problem, but also knows of a place I can actually learn the information for creating .htaccess files, I would be most appreciative.
Thank you for your time.