Solved

Directory index forbidden by rule -- Problem

Posted on 2002-07-04
13
64,605 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

752 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