1
votes

I am trying to prevent users from accessing any files or directory directly except from my index.php using this htaccess:

Options -Indexes
RewriteEngine on 
RewriteCond %{HTTP_REFERER} !^http://(www\.)?REMOVEDLINK [NC] 
RewriteCond %{HTTP_REFERER} !^http://(www\.)?REMOVEDLINK.*$ [NC] 
RewriteRule \.(gif|jpg|png|js|css)$ - [F]
ErrorDocument 403 http://REMOVEDLINK/404.html
ErrorDocument 404 http://REMOVEDLINK/404.html

I just used another htaccess within my php includes folder:

deny from all

Everything works fine except for the fact that it prevents my favicon from being displayed. Code from my index.php:

<link rel="shortcut icon" href="img/favicon.png" type="image/x-icon" />  

How can I allow access for the favicon to be displayed?

1

1 Answers

1
votes

Just below RewriteEngine On line include this rule to allow access to favicon:

RewriteRule img/favicon\.png$ - [NC,L]