Forum Moderators: phranque

Message Too Old, No Replies

Directory index forbidden by rule

My IP in error logs

         

grandma genie

7:15 pm on Oct 18, 2010 (gmt 0)

10+ Year Member



Hi Jim,

Every time I make a change to my osc portion of the site, adding a product or making a change, I get a "Directory index forbidden by rule" error in the error log? What would cause that? The change I make is fine. So why get an error in the log?

Jeannie

The log shows [error] [client my IP] Directory index forbidden by rule: /location of file given here/, referer: mywebsite.com/osc/the change I made shown here.

I wasn't sure how much of the log entry would be OK to show. It gives a lot of info on my site hierarchy.

jdMorgan

11:15 pm on Oct 18, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This may be the "tool" that you are using trying to show you a "directory listing" of the directory that you are working on. If you have "Options -Indexes" in you .htaccess file, and if the /osc directory is in or below that .htaccess file's directory, then generation of indexes will be forbidden.

One work-around is to put a .htaccess file in the /osc directory that contains "Options +Indexes" which will then apply in that subdirectory and its subdirectories only. (If there is already a .htaccess file in that subdir, then of course you would edit it to add this line).

Another is to remove the "Options -Indexes" directive from your main .htaccess file, leaving folks free to poke around in any or all of your subdirectories which do not have an 'index' page in them.

A third option is to replace the "Options -Indexes" directive with a RewriteRule that allows Indexes in /osc but not anywhere else.

Jim

grandma genie

4:37 am on Oct 19, 2010 (gmt 0)

10+ Year Member



I couldn't find any htaccess files with an Options directive except in some folders in the root directory that were put there by the host. They are the _private, _vti_cnf, _vti_log, _vti_pvt folders which I understand have something to do with FrontPage, which I do not use. Those htaccess files show Options None. There is an htaccess file one directory up from the root, but it has no Options directives, nor does the htaccess file in the root or the htaccess file in the OSC folder. Also, do I want folks poking around in the OSC directory or its subdirectories? If having the error showing up in the error log is not a problem, I could just ignore it. I don't want the "fix" to cause more problems.
--Jeannie

jdMorgan

2:01 pm on Oct 19, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It is possible that the Options -Indexes is part of the basic server configuration in httpd.conf or some other server-config file to which you won't normally have access on a shared host. This may be an explicit declaration, appearing as "Options -Indexes" or it may be less direct, like "Options None" followed by "Options +FollowSymLinks", where Indexes are disallowed by "None" but then not re-allowed by any other subsequent Options directive.

Another possibility is that a rewriterule might have been used to disallow indexes. Obviously, there are a million ways to code it, but something like

RewriteCond %{REQUEST_URI} /$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ - [F]

might also be used to prevent directory listings when a directory-index file is absent.

Jim

grandma genie

5:52 pm on Oct 22, 2010 (gmt 0)

10+ Year Member



I found a pub folder in the root directory that has an htaccess file in it that says:

Options +FollowSymLinks -Indexes

Could that be causing the errors? The pub folder came with an oscommerce template.
Also, the same folder is in the osc folder. Also, all the folders that are in the osc folder are duplicated in the root. When I originally moved my site to the new servers, I was having problems making updates to the site. The host's solution was to copy all the material in the osc folder into the root directory. Now I can make updates, but it looks like the server is showing my updating as errors, even though they are taking effect.

Any thoughts on all this, Jim?