Question:
.htaccess directory?
Justeh!
2008-08-21 05:08:19 UTC
I have a folder called /shared/ on my webserver, it has all my images, scripts- the lot in it. How would I stop people from viewing my files without having to put an index.php file in each directory. I would like to use .htaccess so that it pulls them back to my homepage or another designated page.
Three answers:
2008-08-21 05:29:53 UTC
Here is a website that allows you to password protect your folder/website using .htaccess. It shows various methods so you can choose which best fits what you're looking for.



http://www.askapache.com/htaccess/apache-authentication-in-htaccess.html
Anand
2008-08-21 06:06:45 UTC
is not possible

when user views HTML page, their browser also retrieves images, scripts etc used in the page

there is literally no difference between that, and the user entering the image url directly

so if u block direct access to these resource, they cant be used on the web page either



if what u mean is u dont want people to see the index of files when going to the /shared/ directory, then yes u can use .htaccess file to disable directory listing. u can use line:

Option -Indexes
vivek k
2008-08-21 05:19:35 UTC
Use apache rewrite engine to redirect any request to your images or script files in /shared directory to designated location. Please refer to apache documentation for details and examples


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...