OAFC_Rob Posted July 9, 2013 Share Posted July 9, 2013 (edited) 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 ContainersThe <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 July 9, 2013 by OAFC_Rob Quote Link to comment https://forums.phpfreaks.com/topic/279989-apache-conf/ Share on other sites More sharing options...
requinix Posted July 9, 2013 Share Posted July 9, 2013 Most things in .htaccess propagate down to subfolders. It should be applying just fine, if it is applying at all. What if you create a .htaccess in one of the subfolders with the same Option -Indexes? Quote Link to comment https://forums.phpfreaks.com/topic/279989-apache-conf/#findComment-1440084 Share on other sites More sharing options...
OAFC_Rob Posted July 10, 2013 Author Share Posted July 10, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/279989-apache-conf/#findComment-1440131 Share on other sites More sharing options...
kicken Posted July 10, 2013 Share Posted July 10, 2013 (edited) 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 July 10, 2013 by kicken Quote Link to comment https://forums.phpfreaks.com/topic/279989-apache-conf/#findComment-1440226 Share on other sites More sharing options...
OAFC_Rob Posted July 11, 2013 Author Share Posted July 11, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/279989-apache-conf/#findComment-1440283 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.