Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Directory index forbidden by rule -- Problem

Posted on 2002-07-04
13
Medium Priority
?
64,632 Views
Last Modified: 2011-08-18
I've just installed apache, and if I put in

http://www.website.com/, it says "Forbidden", put if I put in http://www.website.com/index.html, it works??

Also I have a directory called "htdocs" and within that is a file called "index.php". If I put in the browser:

http://www.website.com/htdocs/index.php

It comes back with "Page cannot be displayed" although the path is correct.

When I look in the error_log, nothing appears for the second statemant "/htdocs/index.php" but with the first error (http://www.website.com/") the error log shows the following error:

Directory index forbidden by rule

What does mean, and what can I do to resolve it?
0
Comment
Question by:choccarlm
13 Comments
 
LVL 15

Expert Comment

by:samri
ID: 7130963
Choccarlm,

Forbidden is due to the default config for apache is to be quite restrictive.  You would need to enable directory browsing to allow it.
Check apache FAQ:

http://httpd.apache.org/docs/misc/FAQ.html
http://httpd.apache.org/docs/misc/FAQ.html#forbidden
http://httpd.apache.org/docs/misc/FAQ.html#malfiles

Please could you post the config portion that has
DocumentRoot directive.

Mine is on Win32, but it should be OK.

DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"

2nd part of the quesstion: http://www.website.com/htdocs/index.php should have been http://www.website.com/index.php

Remember that htdocs is a Root for your website (/), anything below that directory would have (/dir1, /dir2), and the url would be http://www.website.com/dir1/, etc.

If you want to have index.php to be your default directory index, ie, you would need to type only http://www.websites.com/ (and not http://www.website.com/index.php), look at DirectoryIndex directive.  By default, I believe it is;

DirectoryIndex index.html

My example; the following would make the default indexfile to be index.cgi if it exist, next index.php, index.html, etc.

DirectoryIndex index.cgi index.php index.html index.htm index.html.var

You would need to have mod_dir (http://httpd.apache.org/docs/mod/mod_dir.html) loaded.

I hope this help.

cheers.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7131532
you simply need in httpd.conf:

  Options Indexes

for / directory
0
 

Author Comment

by:choccarlm
ID: 7137160
Ok,

http://www.website.com/ now works, but if I put in http://www.website.com/htdocs/index.php, it still says that the page doesnt exist. If I put in http://www.website.com/includes/index.php, it works.

For some reason, it will not allow me to use "htdocs/...". Why would this be?

Thanks
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 15

Expert Comment

by:samri
ID: 7137233
Choccarlm,

Yes, you cannot use /htdocs/index.php.

Does it work if you just use http://www.website.com/index.php ?

Remember that /htdocs is just a folder in /usr/local/apache/, and if you notice there is a directive; somewhere in you httpd.conf (or look for that directive).

DocumentRoot /usr/local/apache/htdocs

This is to tell apache, evertyhing in this directory would be treated as the root (/) of your website.  And any path under that folder would be another path in the URL.

cheers.
Samri
0
 

Author Comment

by:choccarlm
ID: 7137254
My Document root for this website is

/home/website/

htdocs is a folder within the webiste folder, so it does exist.

If I put in http://www.website.com/, it now works, as does
http://www.website.com/index.php.

I take it I cannot use htdocs as a folder name then?
0
 
LVL 15

Expert Comment

by:samri
ID: 7137292
M,

Hmm... I cannot recall htdocs being so special.  Could you try to create another directory, maybe testdir and try to test.

Btw, do you have any files under htdocs?  Is it possibble to access the file http://www.domain.com/htdocs/something.html

cheers
0
 

Author Comment

by:choccarlm
ID: 7137302
My Document root for this website is

/home/website/

htdocs is a folder within the webiste folder, so it does exist.

If I put in http://www.website.com/, it now works, as does
http://www.website.com/index.php.

I take it I cannot use htdocs as a folder name then?
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 9691020
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area with the following recommendation for this question:

PAQ/Refund (questions not fully answered)

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

periwinkle
EE Cleanup Volunteer
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 9735863
PAQed, with points refunded (50)

Computer101
E-E Admin
0
 

Expert Comment

by:webwide
ID: 10361378
This question WAS answered!  samri seems to have answered it (IMHO)
0
 
LVL 15

Expert Comment

by:samri
ID: 10401355
I tought that so...  :(
0
 

Expert Comment

by:lisajson
ID: 10774712
Is there any way to have the Web users just type in www.website.com instead of www.website.com/ or www.website.com/index.html?

This seems to work on my apache linux machine, but not on my apache windows 2000 machine.

Thanks for any help you can give me!
Lisa
0
 
LVL 15

Expert Comment

by:samri
ID: 10789965
hi Lisa,

>> Is there any way to have the Web users just type in www.website.com instead of www.website.com/ or www.website.com/index.html?

This is among the popular Apache question.

One common solution is to fix the ServerName directive in you httpd.conf (or in the Vhost Container).  Check Apace FAQ here : http://httpd.apache.org/docs/misc/FAQ.html#set-servername

Another thing is to check for DirectoryIndex directive.  It's covered in mod_dir - http://httpd.apache.org/docs-2.0/mod/mod_dir.html (http://httpd.apache.org/docs-2.0/mod/mod_dir.html#directoryindex).

You may need to add

DirectoryIndex index.html index.htm

Hope this would help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Integration Management Part 2
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses
Course of the Month11 days, 12 hours left to enroll

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question