Home > Web Front-end > HTML Tutorial > Method sharing: How to use .htaccess to ban an IP from accessing the website

Method sharing: How to use .htaccess to ban an IP from accessing the website

巴扎黑
Release: 2017-08-07 13:57:58
Original
2606 people have browsed it

This article mainly introduces you to the method of using .htaccess to ban a certain IP from accessing the website. By setting the ban on access to a certain IP segment, it increases the security of the virtual host. The article uses pictures, texts and sample codes. The introduction is very detailed. Friends who need it can refer to it. Let’s take a look together.

Preface

For cost considerations, most webmasters do not purchase separate servers for many small websites, but use Virtual host. If the website is maliciously harvested or CC attacked by others, if you have server permissions, you can prohibit a certain IP segment from accessing the website. Some virtual hosts will also provide an IP blacklist function. If the virtual host does not support IP blacklist, it will be a headache. Linux virtual hosts commonly use .htaccess to set up pseudo-static, and .htaccess processing achieves pseudo-static. There are still many functions that have not been explored. The IP blacklist function can also be implemented through .htaccess. Not much to say below, let’s take a look at the detailed introduction

The method is as follows:

For example, if you want to prohibit access to 104.236.180.129, use Save the following code to the .htaccess file and upload it to the FTP root directory.


Order Deny,Allow
Deny from 104.236.180.129
Copy after login

Access effect after setting:

The above is the detailed content of Method sharing: How to use .htaccess to ban an IP from accessing the website. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template