Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


Sign in to follow this  
EelCapone

[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?

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×