Jump to content

[Apache] How to use the <FilesMatch> directive


Recommended Posts

Hi there,

I want to secure my apache so that it will only serve certain files with certain file extentions. Now I've come up with this:

# =================================================# Access control# =================================================AccessFileName .htaccess<Directory "C:/">   	 # Don't allow access to C: drive	Options None	AllowOverride None	Order deny,allow	Deny from all</Directory><Directory "D:/">   	 # Don't allow access to D: drive	Options None	AllowOverride None	Order deny,allow	Deny from all</Directory><Directory "D:/www">   	 # Allow access to the root of the hosting folder	Options None	AllowOverride None	Order allow,deny	Allow from all	<FilesMatch ".">    # But only to files with the specified extentions  Order allow,deny  Deny from all	</FilesMatch>	<FilesMatch "\.(html|gif|jpg|php|css|js|zip)$">  Order allow,deny  Allow from all	</FilesMatch></Directory>

Now this works just fine, except that it returns a '403 Forbidden' error and I want it to return a '404 Page not found' error.

Anyone know how I can do this?

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...