Deny direct access to all . CSS and JS files except index.php

Deny direct access to all . CSS and JS files except index.php
Means direct access of css or js file deny but not in website.

I am used this code

<Files ~ "\.css$">
  Order allow,deny
  Deny from all

But it deny all

It is not clear what your intention is.
Are you trying to prevent people from “hotlinking” to your files?

I want nobody can access my css/php/js/PNG/jpg/pdf/XML if they try to direct access by enter file or folder url .
But the css/Js and all show on main website.

Means that direct access is deny for user but it show proper way on website homepage.

With the exception of php (because it is server-side), that is not possible unless you take it off-line completely.
Things like css and js are client-side languages, so the files must be downloaded to the client’s browser for them to be active for the website, which means their source may be viewed or copied.

1 Like

Hi there shivkumar,

You can’t always get what you want…

…but if you try sometimes, well, you
might find that you get what you need. :sunglasses:



I am not understand you this song language.

The point being made is that what you appear to be requesting isn’t possible, at least not if you want your page to work. The song is just a bit of light hearted humour, nothing else.


Well, the gist of it is this…

Just because one asks for something, it does not
necessary mean that one can actually have it. :unhappy:

This, of course, is is most definitely applicable to
the request in your original post. :rolleyes:

I trust that this may further your understanding. :winky:


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.