CodeIgniter Forums
Deny direct access to the file. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: Deny direct access to the file. (/thread-74940.html)



Deny direct access to the file. - Digital_Wolf - 11-27-2019

Hello everyone !

As can be to deny direct access on exiled to files in the directory "assets",

in General need do so, to under appeal say to example.com/assets/Favicon.png the user saw page 403 or any other,
but at the same time that this picture was available for inserting it in
PHP Code:
<head>
     <link .... rel="icon" src="<?= base_url('assets/Favicon.png'); ?>" >
</
head

and it was displayed on the site tab.


RE: Deny direct access to the file. - includebeer - 11-27-2019

There’s no way to do that. Your assets (images, js, css) must be publicly available. If the browser can read the favicon file and display it, then the user can also read it.


RE: Deny direct access to the file. - Digital_Wolf - 11-27-2019

(11-27-2019, 06:55 PM)includebeer Wrote: There’s no way to do that. Your assets (images, js, css) must be publicly available. If the browser can read the favicon file and display it, then the user can also read it.
well, thanks for the answer!