2015-05-09 39 views
1

我試圖阻止用戶使用這個htaccess的直接訪問任何文件或目錄,除了從我的index.php: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 

我只是用在另一個htaccess的我PHP包括文件夾:

deny from all 

一切工作正常,除了它阻止我的圖標顯示的事實。我的index.php代碼:

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

我該如何允許訪問favicon來顯示?

回答

1

略低於RewriteEngine On線包括這個規則允許訪問favicon

RewriteRule img/favicon\.png$ - [NC,L] 
相關問題