国产成人精品无码青草_亚洲国产美女精品久久久久∴_欧美人与鲁交大毛片免费_国产果冻豆传媒麻婆精东

15158846557 在線咨詢(xún) 在線咨詢(xún)
15158846557 在線咨詢(xún)
所在位置: 首頁(yè) > 營(yíng)銷(xiāo)資訊 > 網(wǎng)站運(yùn)營(yíng) > Apache偽靜態(tài)規(guī)則文件.htaccess的另類(lèi)用法

Apache偽靜態(tài)規(guī)則文件.htaccess的另類(lèi)用法

時(shí)間:2024-03-02 13:35:01 | 來(lái)源:網(wǎng)站運(yùn)營(yíng)

時(shí)間:2024-03-02 13:35:01 來(lái)源:網(wǎng)站運(yùn)營(yíng)

Apache偽靜態(tài)規(guī)則文件.htaccess的另類(lèi)用法:

1、開(kāi)啟/關(guān)閉拼寫(xiě)檢查(關(guān)閉后會(huì)區(qū)分大小寫(xiě))

CheckSpelling On #開(kāi)啟

CheckSpelling Off #關(guān)閉

關(guān)閉拼寫(xiě)檢查可以解決一下報(bào)錯(cuò)

2、禁止/只允許特定IP訪問(wèn)

(1) 禁止單個(gè)IP訪問(wèn),例如192.168.1.1

Order Allow,Deny

Allow from all

Deny from 192.168.1.1

(2) 禁止IP段訪問(wèn),例如192.168.1.0/24、192.168.0.0/16

Order Allow,Deny

Allow from all

Deny from 192.168.1

Deny from 192.168

(3) 只允許特定IP訪問(wèn),例如192.168.1.1

Order Allow,Deny

Deny from all

Allow from 192.168.1.1

3、防止目錄瀏覽

Options All -Indexes

4、自定義錯(cuò)誤頁(yè)面

ErrorDocument 403 /403.html

ErrorDocument 404 /404.html

ErrorDocument 500 /500.html

5、設(shè)置默認(rèn)首頁(yè)

DirectoryIndex 123.html

6、屏蔽惡意蜘蛛(User Agent)

SetEnvIfNoCase User-Agent "^Baidu" bad_bot

SetEnvIfNoCase User-Agent "^sogou" bad_bot

SetEnvIfNoCase User-Agent "^Bloghoo" bad_bot

SetEnvIfNoCase User-Agent "^Scooter" bad_bot

Deny from env=bad_bot

7、防盜鏈

RewriteEngine on

RewriteCond %{HTTP_REFERER} !^$ [NC]

RewriteCond %{HTTP_REFERER} !google.com [NC] #白名單域名,谷歌

RewriteCond %{HTTP_REFERER} !baidu.com [NC] #白名單域名,百度

RewriteCond %{HTTP_REFERER} !test.com [NC] #白名單域名,自己的域名添加上

RewriteRule .*/.(jpg|gif|png|jpeg)$ http://deny.com [R,NC,L] #不在白名單的訪問(wèn)跳轉(zhuǎn)到特定url上

8、禁止訪問(wèn)特定目錄,例如拒絕任何人訪問(wèn)abc目錄

在abc目錄下創(chuàng)建.htaccess,寫(xiě)入一下內(nèi)容:

deny from all

9、http跳轉(zhuǎn)到https

RewriteCond %{SERVER_PORT} !^443$

RewriteRule ^.* https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

關(guān)鍵詞:靜態(tài),規(guī)則,文件

74
73
25
news

版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。

為了最佳展示效果,本站不支持IE9及以下版本的瀏覽器,建議您使用谷歌Chrome瀏覽器。 點(diǎn)擊下載Chrome瀏覽器
關(guān)閉