Malasorte
Malasorte

Reputation: 1173

Deny files with .htaccess

I already know how to do that:

<Files "myfile.txt">
Order Allow,Deny
Deny from all
</Files>

My question: will the server still be able to access the file? What if it was myfile.js or myfiles.css. In this case, will the server still be able to load the js or the css?

Thank you!

Upvotes: 0

Views: 51

Answers (1)

Amadan
Amadan

Reputation: 198304

If by "server" you mean Apache, it will be able to access the files, but it will refuse to serve them to a client.

However, css files for example are utterly useless unless they can be delivered to a client, so whether or not a server has access to them is rather irrelevant in most cases. You may want to ask about the problem you are actually interested in. (See XY problem.)

If you have a subprocess like a PHP script or a Ruby Passenger app, they would be able to retrieve the files and circumvent Apache's checks.

Upvotes: 2

Related Questions