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

Mysql inner join on usage examples (must read)

Grammatical rules SELECT column_name(s) FROM tabl...

Specific use of MySQL window functions

Table of contents 1. What is a window function? 1...

On good design

<br />For every ten thousand people who answ...

Detailed explanation of Vue's monitoring method case

Monitoring method in Vue watch Notice Name: You s...

Detailed explanation of Vue's list rendering

Table of contents 1. v-for: traverse array conten...

Use of filter() array filter in JS

Table of contents 1. Introduction 2. Introduction...

js to achieve simulated shopping mall case

Friends who are learning HTML, CSS and JS front-e...

jQuery implements HTML element hiding and display

Let's imitate Taobao's function of displa...

Tutorial on installing Tomcat server under Windows

1 Download and prepare First, we need to download...

Explanation of the concept and usage of Like in MySQL

Like means "like" in Chinese, but when ...

Detailed explanation of how to find the location of the nginx configuration file

How can you find the location of the configuratio...

MySQL 8.0.12 Installation and Usage Tutorial

Recorded the installation and use tutorial of MyS...

Using react-virtualized to implement a long list of images with dynamic height

Table of contents Problems encountered during dev...