1

I need to block directory access but allow access to files if typed into a browser.

Also would like this to load my custom 403.shtml

1
Options -Indexes
ErrorDocument 403 /path/to/403.shtml

Both lines go into an .htaccess file in your root directory

  • Thanks but sorry this does not allow access to files. – user10560 Oct 27 '11 at 2:51
  • 1
    Do you have any error? Code snippet above must work, if AllowOverride in server's config allow you to use redefines in htaccess – Lazy Badger Oct 27 '11 at 9:51
  • This does block directory access, however it also blocks file access. Typing either into a browser gives the 403. I'm a bit new to this stuff so I'm not certain on AllowOverride. – user10560 Oct 27 '11 at 15:16
  • I must admit I'm a bit surprised no one has an answer for this. – user10560 Oct 28 '11 at 12:24
  • My answer is correct. If it doesn't work for you then your server is not correctly configured or not configured to allow you to do this. – John Conde Oct 28 '11 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy