Jump to content

Recommended Posts

If I have the following in my Apache conf file will this prevent indexes to sub-directories of public_html or will it only apply to the public_html directory.

<Directory "C:/server/www/myserver.dev/public_html">
    Options -Indexes FollowSymLinks
    AllowOverride All	
    Order allow,deny
    Allow from all
</Directory>

I thought it would apply to all sub-directories, much like a .htaccess rule

 

-----------------------

 

Just taken directly from the apache website

 

 

Filesystem Containers

The <Directory> and <Files> directives, along with their regex counterparts, apply directives to parts of the filesystem. Directives enclosed in a <Directory> section apply to the named filesystem directory and all subdirectories of that directory (as well as the files in those directories). The same effect can be obtained using .htaccess files. For example, in the following configuration, directory indexes will be enabled for the /var/web/dir1 directory and all subdirectories.

<Directory /var/web/dir1>
Options +Indexes
</Directory>

So why on earth wouldn't my rule apply to all my sub-directories???

Edited by OAFC_Rob
Link to comment
https://forums.phpfreaks.com/topic/279989-apache-conf/
Share on other sites

The issue isn't with .htaccess files, that was my workable solution to the problem. I created a .htaccess file that did what I wanted at the public_html folder and now that has been inherited down to the sub-directories.

 

However, if I remove this file and put the same -Indexes in the apache conf as in /apache/conf/httpd the rule doesn't apply to any of the directories which is rather annoying when it should. Especially when it works on the local machines and development server.

Link to comment
https://forums.phpfreaks.com/topic/279989-apache-conf/#findComment-1440131
Share on other sites

I'd venture to guess that you may have another <Directory> or Options elsewhere that is overruling the one you want applied. Setting the options in httpd.conf within a <Directory> has always worked fine for me, both for the target directory and it's subfolders.

 

Edit: On a side note:

Note

 

Mixing Options with a + or - with those without is not valid syntax, and will be rejected during server startup by the syntax check with an abort.

So your Options -Indexes FollowSymLinks is invalid and the server shouldn't even be starting up with that line in place.

Edited by kicken
Link to comment
https://forums.phpfreaks.com/topic/279989-apache-conf/#findComment-1440226
Share on other sites

The server starts so I know that there is nothing wrong there. I commented out all the other directory lines as I thought the same it would be being overridden somewhere, but that made no change.

 

The only thing I can think of is it that because it is a Windows Server running apache it is just........... retarded!

 

Not too much of an issue, because the .htaccess file is in place, it just hurting my man pride a bit.

Link to comment
https://forums.phpfreaks.com/topic/279989-apache-conf/#findComment-1440283
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.