How to prevent direct access folder and file through URL

Only this was helpful but if we use this link Need help for hacking problem in OJS - #4 by asmecher then feature is disabled.
I think this is not a permanent solution.