apache2 2 盜鏈問題

2021-08-29 08:49:43 字數 597 閱讀 4125

先來介紹乙個http請求頭 叫[b]referer[/b],通過下面這句可以取到他的值

[code]string referer = request.getheader("referer");[/code]

referer是幹什麼的呢? referer可簡單的理解為記錄了上乙個頁面的url,直接從url訪問乙個頁面時它的referer為null。

[code]public void dofilter(servletrequest req, servletresponse resp,

filterchain chain) throws ioexception, servletexception else

}[/code]

很簡單的乙個過濾器 在web.xml中配置一下, 馬上試試吧

[code]

resourceaccessfilter

com.redgateonline.daren.web.filter.resourceaccessfilter

*.***

[code]非法請求**,轉到首頁[/code]

結果是令人失望的-----儲存成功了。

見四樓

修改apache2 2主頁

方法 一 進入apache的conf目錄 修改httpd.conf 1 找到 documentroot d program files apache software foundation apache2.2 htdocs 這一行,意思是預設專案目錄,修改為自己專案所在目錄 2 改了上面的配置是訪問...

Apache2 2快取配置

參見原文 url mod expires可以減少10 左右的重複請求,讓重複的使用者對指定的頁面請求結果都cache在本地,根本不向伺服器發出請求。loadmodule expires module modules mod expires.so expiresactive on expiresbyt...

apache2 2多網域名稱繫結

apache2.2多網域名稱繫結不同目錄,將 放在httpd.conf最後 namevirtualhost 80 servernamewo.com serveralias domain.tld domain.tld documentroot www domain servernamewozine.c...