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

CSS flexible layout FLEX, media query and mobile click event implementation

flex layout Definition: The element of Flex layou...

Detailed steps to install CentOS7 system on VMWare virtual machine

Pre-installation work: Make sure vmware workstati...

Implementation of nginx flow control and access control

nginx traffic control Rate-limiting is a very use...

Advanced techniques for using CSS (used in actual combat)

1. The ul tag has a padding value by default in Mo...

uniapp dynamic modification of element node style detailed explanation

Table of contents 1. Modify by binding the style ...

Vue implements click feedback instructions for water ripple effect

Table of contents Water wave effect Let's see...

Analysis of a MySQL deadlock scenario example

Preface Recently I encountered a deadlock problem...

Summary of the application of decorative elements in web design

<br />Preface: Before reading this tutorial,...

Detailed explanation of MySQL database (based on Ubuntu 14.0.4 LTS 64 bit)

1. Composition and related concepts of MySQL data...

How to simplify Redux with Redux Toolkit

Table of contents Problems Redux Toolkit solves W...

Several commonly used single-page application website sharing

CSS3Please Take a look at this website yourself, ...

How to optimize the slow Like fuzzy query in MySQL

Table of contents 1. Introduction: 2. The first i...

javascript countdown prompt box

This article example shares the specific code of ...