Deny folder permission that is used by url (www.xxxxxx.com/data/xx.php) or browsing
<p>How do I do to stop user/client to navigate in some of my website folders using URL like this:</p>

<pre><code>www.site.com/main_folder/subfolder_Contaienr/files.php
www.site.com/main_folder/data/files.php
www.site.com/main_folder/data/also_here_text_files.txt
</code></pre>

<p>With this URL, the user can navigate to my folders and I do not want that he navigate to my website folders.</p>

<p>Also everyday I have some new folders. I use files in folder for external scope (e.g in some folder there are images and need to show users. In some folders are text files in which is JSON data or some users details.)</p>

<p>Is there any way to stop navigate to my folders <strong><em>using php Code</em></strong> without touching <code>.htacess</code> file?</p>