search
HomeBackend DevelopmentPHP TutorialUse .htaccess to deny certain IP access to the website_PHP tutorial

What should we do if we find out that a certain IP frequently attacks our website or if we want to deny this IP access to our website for other reasons? Let’s share a way to deny access to a certain IP through .htaccess.

Edit the .htaccess file and enter the following content:

order allow,deny
deny from 110.120.16.11
deny from 108.8.32.
allow from all

Save the above content and put it under the root directory of the site to deny the specified IP from accessing the website. The second line of the above code is to deny the IP address 110.120.16.11 from accessing our site. The third line It is to deny users in the IP range 108.8.32.0 - 108.8.32.255 from accessing our site. Of course what if you want to deny everyone access to your site? Just use deny from all directly. In addition, in addition to filling in the IP address, the prohibited information can also be set by domain name, as follows:

order allow,deny
deny from baidu.com
deny from www.google.cn
allow from all

Articles you may be interested in

  • How to use .htaccess to prevent hotlinking website images
  • Using .htaccess ban list directories
  • Using .htaccess Set the default homepage of the website
  • How to modify the default homepage of the website through .htaccess?
  • 10 practical .htaccess code snippets
  • .htaccess How to set up anti-hotlinking for images in a directory
  • Use Apache’s htaccess to prevent images from being hotlinked
  • Use PHP’s GZip compression function to compress website JS and CSS files to speed up website access

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/764184.htmlTechArticleIf it is found that an IP frequently attacks our website or for other reasons, we intend to deny access to this IP What should we do when opening our site? Let’s share a way to pass...
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
网站怎么通过nginx设置黑/白名单IP限制及国家城市IP访问限制网站怎么通过nginx设置黑/白名单IP限制及国家城市IP访问限制Jun 01, 2023 pm 05:27 PM

一、黑/白名单IP限制访问配置nginx配置黑白名单有好几种方式,这里只介绍常用的两种方法。1、第一种方法:allow、denydeny和allow指令属于ngx_http_access_module,nginx默认加载此模块,所以可直接使用。这种方式,最简单,最直接。设置类似防火墙iptable,使用方法:直接配置文件中添加:#白名单设置,allow后面为可访问IPlocation/{allow123.13.123.12;allow23.53.32.1/100;denyall;}#黑名单设置,

ip与mac绑定什么意思ip与mac绑定什么意思Mar 09, 2023 pm 04:44 PM

ip与mac绑定是指将特定的IP地址与特定的MAC地址关联起来,使得只有使用该MAC地址的设备才能够使用该IP地址进行网络通信。ip与mac绑定可以防止被绑定的主机的IP地址不被假冒,前提条件:1、MAC地址是唯一的,并且不可假冒;只能绑定与路由器直接相连的网络上的主机(也就是主机的网关在路由器上)。

微信怎么查看ip地址微信怎么查看ip地址May 31, 2023 am 09:16 AM

微信查看ip地址的方法:1、登录电脑版微信,右键点击屏幕下方的任务栏,点击“任务管理器”;2、弹出任务管理器时,点击左下角的“详细信息”;3、任务管理器进入“性能”选项,点击“打开资源监视器”;4、选择“网络”,勾选微信进程“Wechat.exe”;5、点击下面的“TCP连接”即可监视微信网络IP相关情况,发送消息得到回复就会显示他人的IP地址。

nginx如何设置目录白名单和ip白名单nginx如何设置目录白名单和ip白名单May 18, 2023 pm 03:52 PM

1.设置目录白名单:对指定请求路径不设置限制,如对请求路径为api目录下的请求不做限制,则可写为server{location/app{proxy_passhttp://192.168.1.111:8095/app;limit_connconn20;limit_rate500k;limit_reqzone=fooburst=5nodelay;}location/app/api{proxy_passhttp://192.168.1.111:8095/app/api}}#因nginx会优先进行精准匹

基于nginx反向代理如何获取用户真实Ip地址基于nginx反向代理如何获取用户真实Ip地址May 13, 2023 pm 05:07 PM

引言nginx做反向代理时,默认的配置后端获取到的Ip地址都来自于nginx,用request.getRemoteAddr();获取到的是nginx的ip地址,而不是用户的真实ip.1.修改Nginx配置:server{listen80;server_namejenkins.local.com;location/{proxy_set_headerHost$host;proxy_set_headerX-Real-IP$remote_addr;proxy_passhttp://192.168.10.

本机ip地址查询本机ip地址查询Jan 05, 2024 pm 01:42 PM

本机ip地址查询的方法有:1、 Windows系统下,打开“开始菜单”并搜索“cmd”打开命令提示符,输入“ipconfig”,然后按回车键,查找名为“IPv4 地址”的一行,其旁边的数字就是本机的IP地址;2、macOS系统下,点击屏幕左上角的苹果图标,选择“系统偏好设置”,在“网络”选项中找到当前连接的网络,点击“高级”按钮,在“TCP/IP”选项卡中查找本机的IP等等。

wifi显示无ip分配怎么办wifi显示无ip分配怎么办Aug 30, 2023 am 11:58 AM

wifi显示无ip分配的解决办法:1、重新启动设备和路由器,关闭设备上的Wi-Fi连接,关闭设备,关闭路由器,等待几分钟,然后重新打开路由器链接wifi;2、检查路由器设置,重启DHCP,确保DHCP功能已经启用;3、重置网络设置,将删除所有已保存的WiFi网络和密码,在执行此操作之前,请确保已备份;4、更新路由器固件,登录路由器管理界面,查找固件更新选项,并按照提示进行操作。

支付宝怎么拒绝别人转账-支付宝拒绝别人转账的方法支付宝怎么拒绝别人转账-支付宝拒绝别人转账的方法Mar 18, 2024 am 11:50 AM

支付宝怎么拒绝别人转账?支付宝的转账机制是:一旦支付宝账户接收到他人的转账,这些资金会直接进入您的账户余额,除非您选择退款,否则您不能直接拒绝接收。如果您不希望接收到某人的转账怎么办呢?下面就和小编一起来看看解决方法吧!1.与对方直接沟通最直接和有效的方式是与对方直接沟通,明确告知不希望接收到转账的原因,请对方不要继续进行转账。2.设置隐私权限在支付宝的隐私设置中,关闭通过“邮箱”、“手机号”向我转账,同时选择对陌生人隐藏自己的真实姓名,这样陌生人在进行转账时会因为无法确认您的真实身份而可能放弃

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!