How to use .htaccess to prohibit a certain IP from accessing the website

How to use .htaccess to prohibit a certain IP from accessing the website

Preface

For cost considerations, most webmasters do not purchase servers separately for many small websites, but use virtual hosts instead. If a website is maliciously collected or attacked by CC, if you have server permissions, you can prohibit a certain IP segment from accessing the website. Some virtual hosts also provide IP blacklist functions. If the virtual host does not support IP blacklist, it will be a headache. Linux virtual hosts often use .htaccess to set pseudo-static. .htaccess processing implements pseudo-static, and there are still many functions that have not been discovered. The IP blacklist function can also be implemented through .htaccess. Let's take a look at the detailed introduction.

Here’s how:

For example, if you want to block access from 104.236.180.129, save the following code to a .htaccess file and upload it to the FTP root directory.

Order Deny,Allow
Deny from 104.236.180.129 

The access effect after setting:

Summarize

The above is the full content of this article. I hope that the content of this article can bring some help to your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support of 123WORDPRESS.COM.

<<:  Detailed explanation of how to create an array in JavaScript

>>:  What is ssh? How to use? What are the misunderstandings?

Recommend

Using text shadow and element shadow effects in CSS

Introduction to Text Shadows In CSS , use the tex...

jQuery plugin to implement minesweeper game (3)

This article shares the third article on how to u...

JavaScript jigsaw puzzle game

This article example shares the specific code of ...

How to use DCL to manage users and control permissions in MySQL

DCL (Data Control Language): Data control languag...

MySQL concurrency control principle knowledge points

Mysql is a mainstream open source relational data...

Explain MySQL's binlog log and how to use binlog log to recover data

As we all know, binlog logs are very important fo...

CSS style to center the HTML tag in the browser

CSS style: Copy code The code is as follows: <s...

MySQL 5.7.18 installation and configuration tutorial under Windows

This article shares the installation and configur...

Implementation code of front-end HTML skin changing function

50 lines of code to change 5 skin colors, includi...

Several common methods for setting anchor positioning in HTML

There are several ways I know of to set anchor pos...

Pure CSS to achieve the effect of picture blinds display example

First, let me show you the finished effect Main i...

Complete steps to implement face recognition login in Ubuntu

1. Install Howdy: howdy project address sudo add-...

Sharing experience on MySQL slave maintenance

Preface: MySQL master-slave architecture should b...