error: Directory index forbidden by Options directive

Summary:  Disabling Directory Index is a good feature from security prospetive. But when your web user don’t have exact permission to specific directory, you will not be able to browse anything. You will have the error: Directory index forbidden by Options directive. I have resolved the issue and the procedure is listed below.

[root@localhost ]# tail -f /var/log/httpd/error_log

In apache error log I got following error.

[Wed Oct 07 15:59:50 2008] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/testfolder/

I changed the AllowOverride option but nothing is happend. Then I read the welcome page text
“To prevent this page from ever being used, follow the instructions in the file /etc/httpd/conf.d/welcome.conf.”
I opend the welcome.conf file.
I found following lines in welcome.conf file.

Options -Indexes
ErrorDocument 403 /error/noindex.html

I changed that to as follows:

Options Indexes
ErrorDocument 403 /error/noindex.html

That solve my problem. Some time your selinux will cause the issue so you need to deactivate the selinux.
Some time File permission will also cause the issue.
You can change the file permission using following command, go to that directory and run following command.
#chmod 777 *
Please Note that the 777 is highly risky for any folder and file.
The correct method is to check the owner of the directory and change the owner accordingly. The commnad used for change owner is chown.

If you have any difficulty, update us through comments i will guide how to do that.

Comments
  1. 4 years ago
  2. 4 years ago
    • 4 years ago
  3. 4 years ago
  4. 3 years ago

Leave a Reply

Your email address will not be published. Required fields are marked *