Solved

Directory index forbidden by rule -- Problem

Posted on 2002-07-04
13
64,579 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
Comment Utility
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
Comment Utility
you simply need in httpd.conf:

  Options Indexes

for / directory
0
 

Author Comment

by:choccarlm
Comment Utility
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
 
LVL 15

Expert Comment

by:samri
Comment Utility
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
Comment Utility
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
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:choccarlm
Comment Utility
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
Comment Utility
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
Comment Utility
PAQed, with points refunded (50)

Computer101
E-E Admin
0
 

Expert Comment

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

Expert Comment

by:samri
Comment Utility
I tought that so...  :(
0
 

Expert Comment

by:lisajson
Comment Utility
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
Comment Utility
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now