對於網站安全性,我想使用web.config將單個IP地址或幾個IP地址重定向到不同的域。我對此很陌生。我知道如何限制訪問權限或阻止某些IP,但有沒有簡單的重定向方法?謝謝!web.config通過ip重定向
0
A
回答
0
重定向某些IP地址,您將需要使用URL redirect rules engine可供IIS 7
檢查此鏈接瞭解如何通過IP地址重定向指令: https://webmasters.stackexchange.com/questions/31509/web-config-to-redirect-except-some-given-ips
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="(.*)$" ignoreCase="false" />
<conditions>
<add input="{REMOTE_HOST}" pattern="^123\.123\.123\.123" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="/coming-soon.html" />
</rule>
</rules>
</rewrite>
1
無法回覆以Victor的評論,所以我會把我編輯的代碼放在這裏,而不是建議更改。
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="(.*)$" ignoreCase="false" />
<conditions>
<add input="{REMOTE_HOST}" pattern="^123\.123\.123\.123" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="http://www.domain-to-redirect-to/coming-soon.html" />
</rule>
</rules>
</rewrite>
這裏的變化是,它重定向到一個新的域作爲提問者想要的東西,而不是在同一個域中的頁面。
請注意,如果您想在同一個域名上重定向到coming-soon.html,則需要更改匹配規則,否則您將被置於重定向循環中。
這樣:
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="(.*)coming-soon.html$" ignoreCase="false" negate="true" />
<conditions>
<add input="{REMOTE_HOST}" pattern="^123\.123\.123\.123" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="/coming-soon.html" />
</rule>
</rules>
</rewrite>
相關問題
- 1. htaccess通過IP範圍重定向
- 2. 通配符重定向url重寫web.config
- 3. 重定向IP
- 4. 重定向的https:// WWW到https://通過web.config中
- 5. web.config索引重定向
- 6. URL重定向的web.config
- 7. 機器人的通用IP重定向
- 8. 通過地理/國家/地區IP重定向Apache
- 9. 通過端口的本地URL IP重定向
- 10. 通過IP在htacess中重定向用戶
- 11. htaccess重定向特定IP
- 12. HTTPS通過HTTP重定向通過.htaccess
- 13. 通過條件重定向?
- 14. 通過jQuery重定向
- 15. 通過異常重定向
- 16. 通過servlet重定向JSP
- 17. 重定向通過在PHP
- 18. 通過它重定向到
- 19. URL重定向通過HTACCESS
- 20. 多個IP重定向
- 21. 將IP重定向到域
- 22. 重定向域名到IP
- 23. web.config重定向到https導致重定向循環
- 24. 泡泡通知通過重定向
- 25. 通過web.config中
- 26. 如何通過Codeigniter中的重定向URL重定向到URL?
- 27. Web.config重定向到http://www.example.com到https://example.com
- 28. web.config中的IIS url重定向規則
- 29. 重定向後登錄:Web.config中
- 30. 哪個重定向更好 - web.config或global.asax
謝謝,維克多。有沒有辦法做到這一點,它只是重定向來自某些IP的請求? – user2117017 2013-02-27 20:36:30
您好,以上答案。我希望這個解決方案適合你。 – Victor 2013-02-27 20:43:18