Set directory index to .html file in Apache2

I have a Debian web server with Apache2 installed and you need to install the .html file in the same DirectoryIndex directory (this is the name -.html). But when I try to open the page from the browser, it sends an error 403. I changed apache2.conf (to allow .ht files), I put the .htacess file in the directory and installed in it:

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

But it still does not work and displays error 403. What am I doing wrong and what did I forget to do?

+4
source share
2 answers

Correct answer:

 <FilesMatch "^\.html"> Order deny,allow </FilesMatch> DirectoryIndex .html 
+5
source

It looks like you have a rule somewhere in your apache file that denies access to files starting with . . This is usually a good thing, since many sensitive files start with dots (for example: .htaccess, .svn, .git, .htpasswd, etc. Etc.).

You may be able to work around the problem like this:

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

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

+1
source

All Articles