对于网站安全性,我想使用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