PDA

View Full Version : Redirecting a visitor from a folder to the root directory



qwerty12
03 Aug 2012, 06:38 AM
When a user manually navigates to a certain folder on a website (images), how do you redirect them to the root directory?

qwerty12
13 Aug 2012, 11:24 AM
This worked for me:

Inside the .htaccess file in the root directory, place the follow at the very top:


Options -Indexes

Upon a visitor accessing a folder with no index.html, they are sent to the root index.html, rather than being able to view a list of folder contents.

NOTE: A file within the folder CAN still be accessed by typing its complete path. (Example: mysite.com/images/picture.jpg)