PDA

View Full Version : help with htaccess - directory listing please


allan smith
10-21-2006, 07:15 AM
I have put the following .htaccess in the root of my web site

# <-- To stop browsing a folder -->

Options -Indexes

# <-- Custom Error Pages -->

ErrorDocument 401 /error_docs/unauthorised.html
ErrorDocument 403 /error_docs/forbidden.html
ErrorDocument 404 /error_docs/not_found.html
ErrorDocument 500 /error_docs/internal_server_error.html

This stops directory browsing and sets home grown error pages
and it works.
Try access ing http://www.telfordsteamrailway.co.uk/guidedtour/ and you get an error page.
it also works in all sub folders from the root, with no additional .htaccess files in the structure.

However I want to permit browsing in
http://www.telfordsteamrailway.co.uk/forms/
so I put the following in that folder

# <-- To enable browsing browsing in this and deeper folders -->
Options +Indexes
(just the 2 lines as shown) but if you try it you still get the error

where did I go wrong?

help appreciated

Allan

nox-Hand
10-21-2006, 10:52 AM
If I know correctly, the .htaccess works for the folder and ALL subfolders - i.e, also your forms folder. If not, are they chmodded correctly?

allan smith
10-22-2006, 02:40 AM
Yes - I tried an experiment - I put a different 'not found' page pointer in the .htaccess in the forms folder. This was picked up and the different page returned - so the .htaccess file in the forms folder was being used - but the browser option was not being implemented

nox-Hand
10-22-2006, 06:52 AM
*sighs*

Sorry mate, I have no idea about this. This is more of an Apache Web Server question is it not? Maybe I'll get a mod to move the thread :)

allan smith
10-22-2006, 10:16 AM
many thanks - yeah get it moved -
I have - in the meantime developed a work around
I have left the root folder with an .htaccess the calls up the home grown error pages and have not put any statement re 'Indexes' - thus using the ISP default - which is 'permit'.

At the base of each branch I have added a sperate .htaccess with '-Indexes', and only left the branch (which is only a single folder) I want to permit browsing with a .htaccess

It seems to work - but is not 'the correct way' which is surely - stop everything, and only permit specifics.

nox-Hand
10-22-2006, 10:52 AM
Well, untill this thread gets moved, I am sure this is fine :)