如何在.htaccess文件中阻止对特定路由的访问 [英] How to block access to a particular route in .htaccess file

查看:60
本文介绍了如何在.htaccess文件中阻止对特定路由的访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用.htaccess文件阻止除IP列表之外的每个人对Web应用程序中特定路由的访问。当我说将IP阻止和列入白名单时,我想在特定路由上使用以下内容

I need to block access to a particular route in my web application using a .htaccess file for everyone except a list of IP's. When I say block and whitelist IP's I want to use the following on particular route

order deny,allow
deny from all
allow from 1.1.1.1
allow from 2.2.2.2

由于它是托管托管提供程序,因此我无权访问服务器配置文件

I do not have access to the server config file since it is a managed hosting provider

我要阻止的路由例如: http:// www。 example.com/route1

The route I want to block is for eg: http://www.example.com/route1

有办法吗?

感谢您的预先帮助

推荐答案

您绝对可以实现

.htaccess文件

<files route1>
    order deny,allow
    deny from all
    allow from my.ip.address
</files>

这篇关于如何在.htaccess文件中阻止对特定路由的访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆