Ho to hidden the folder on ubuntu server?

April 18, 2014 846 views
Suppose My site Url sitename////index.php When i enter the url like this sitename/// User can see what are folder is available under this url . I don't want to show the folder how to block this.
1 Answer
For Apache:
Add the following line to your .htaccess file.

Options -Indexes

Make sure you hit the ENTER key (or RETURN key if you use a Mac) after entering the "Options -Indexes" words so that the file ends with a blank line.

For Nginx:
Try something like this in config file:

location /{
root /home/yozloy/html/;
index index.html;
autoindex on;

"autoindex" is the key, u can google it.

The answers are all googled.
Have another answer? Share your knowledge.