我試圖阻止使用htaccess.My網站直接訪問我的網站資源orlandojoes.co.uk/clouds這是一個子文件夾。但如果我在地址中輸入orlandojoes.co.uk/clouds/css/style.css
酒吧我可以看到他們。但我想阻止尋求他們,並重定向到index.html。防止使用直接url查看css和js文件
我想:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?orlandojoes.co.uk\.ltd [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?orlandojoes.co.uk\.ltd.*$ [NC]
RewriteRule \.(gif|jpg|js|txt|css)$ /HeyManYouHaveComeToAwrongPlace;) [L]
但在index.html頁面顯示all.Even只加價不與花式它塊。 什麼可以解決?
爲什麼要阻止直接訪問?即使成功,用戶仍然可以在加載任何一個html頁面使用這些資源後查看這些文件。 – nnnnnn
這與html css或javascript –
無關,看着ReqriteCond行,你會阻止請求,除非它們來自'www.orlandojoes?co?uk.ltd' - 在哪裏?是任何字符 - 我認爲你需要檢查RewriteCond語法 –