4

I have a Debian web-server with Apache2 installed and need to set in one directory DirectoryIndex to .html file (exactly this name - .html). But when I try to open page from browser it send 403 error. I've changed apache2.conf (set to allow .ht files), I placed .htacess file in directory and set in it:

DirectoryIndex .html index.php index.html
AllowOverride All
Order Deny,Allow
Allow from all

But it still not work and displays 403 error. What i doing wrong and what i forget to do?

2 Answers2

5

The correct answer is:

<FilesMatch "^\.html">
        Order deny,allow
</FilesMatch>

DirectoryIndex .html
akond
  • 15,865
  • 4
  • 35
  • 55
1

Sounds like you have a rule somewhere in your apache file that denys access to files starting with a .. This is generally a Good Thing, as a lot of sensitive files start with dots (ie: .htaccess, .svn, .git, .htpasswd, etc etc).

You might be able to get around the issue with something like this:

<FilesMatch "^\.html">
 Order allow,deny
 Allow from all
</Files>

Disclaimer: This seems like a hack. I don't know what you're trying to do, but there's probably a cleaner, less error prone way to do it.

Damien Wilson
  • 4,540
  • 3
  • 21
  • 27
  • Thank you for good answer but i'm already do it in apache2.conf: Order allow,deny Allow from all I also tried your code but it still 403 error. – Evgeniy Skulditsky May 31 '11 at 08:17