Gossamer Forum
Home : General : Perl Programming :

directory browsing

Quote Reply
directory browsing
To deter directory browsing, I stuck a .htaccess file in the root dir with the following contents:

IndexIgnore *
IndexOptions SuppressColumnSorting SuppressDescription SuppressHTMLPreamble SuppressLastModified SuppressSize

Only thing is that this still shows the title "Index of /directory". Is it possible to give a 403 forbidden error instead?

Any ideas are appreciated!


-----------
Jason Dulberg
Extreme MTB
http://extreme.nas.net
Quote Reply
Re: directory browsing In reply to
Hi Jason,

Can't you just turn Indexes off?

Options -Indexes

HTH,
adam

Quote Reply
Re: directory browsing In reply to
If you are on an Apache Server, then all you have to do is use ErrorDocument and DirectoryIndex commands within your .htaccess file.

Example:

Code:

ErrorDocument 401 /errors/access.shtml
ErrorDocument 404 /errors/badurl.shtml
ErrorDocument 405 /errors/method.shtml
ErrorDocument 500 /errors/server.shtml
DirectoryIndex index.cgi index.shtml index.html index.htm index.php index.php3 /errors/forbidden.shtml


Also, another thing you could do is set the ErrorDocument to go back to your homepage rather than formatting individual error pages.



Regards,

Eliot Lee
Quote Reply
Re: directory browsing In reply to
Dahamsta, would that be set up in an .htaccess file?

-----------
Jason Dulberg
Extreme MTB
http://extreme.nas.net
Quote Reply
Re: directory browsing In reply to
Yip. See the Apache docs for the Options directive - the minus (-) just pulls the Indexes option out of the parent. If you're doing it in the server config, you'll need to wrap it up in a <Directory> block. And a pretty bow.

adam

Quote Reply
Re: directory browsing In reply to
Great, I stuck it in the server config and it works perfectly.

Thanks!


-----------
Jason Dulberg
Extreme MTB
http://extreme.nas.net
Quote Reply
Re: directory browsing In reply to
No bovver Jason, you're welcome.

adam