Home / Web Hosting / Deny Access to Any Files

Deny Access to Any Files

403 forbidden error, access denied
Question: I have a set of files on my website with the extension .rpc. They are financial files, and I want to make sure that no one can access them from the web. Can i do that?

Answer: On an Apache server, you can do just about anything, and .htaccess files make a lot of that possible. Simply create an .htaccess file or use the one you already have and add something like this:

<Files ~ "^.*\.([Rr][Pp][Cc])">
Order allow,deny
Deny from all
Satisfy All

The letters are repeated in lowercase and capital to ensure both are blocked. Simply substitute the letters with whatever extension you want to deny. For example: <Files ~ "^.*\.([Ll][Oo][Gg])"> will deny access to all .log files. It really is that simple.

Check Also


Importance of web hosting to business

The world of business is very ruthless and unfair in some cases. It is a …