. htaccess restricted access based on IP address

Source: Internet
Author: User

Shielded IP Address

Shielding the IP address is sometimes very necessary, for example, for a foreign trade company's website, from the domestic access is not to bring any economic benefits, but also occupy the server resources, causing access delays and other issues.

If you want to block a specific IP, you can use:

Order Allow,deny

Deny from 192.168.0.1

Allow from all

If you want to block multiple IP addresses, just add a few more deny from

Order Allow,deny

Deny from 192.168.0.2

Deny from 192.168.0.3

Deny from 192.168.0.4

Allow from all

If you need to block the entire IP segment, you can use

Order Allow,deny

Deny from 192.168.0

Allow from all

If you want to block only a small subset of IP in the IP segment, you can use the

Order Allow,deny

Deny from 192.168.0.100/200

Allow from all

allow only specific IP access

If you use a fixed IP, you can limit only your IP can access the background of the site, such as WordPress site background address for/wp-admin/you can create a. htaccess file in that directory, and then IP-qualified.

If you are a regional site and do not want to visit your site, you only need to set the IP segment of the region to be accessible.

The specific method is also very simple, the above deny from and allows from the position of a change, such as:

Order Allow,deny

Allow from 192.168.0.100/200

Denyfrom All

Allow IP segment 192.168.0.100 to 192.168.0.200 user access, no other IP is accessible.

how to block "pseudo-original" websites

Now "pseudo-original" to the original creator caused great trouble, many are using plug-ins or crawlers to the original site of the content of plagiarism, once you find a site on your content "pseudo-original", you can use the method described in this chapter to block the site.

The simple approach is to change the IP to a URL, for example:

Order Allow,deny

Deny from. abc.com

Allow from all

The above configuration is to block all access from the ABC.com website, which you may have found. abc.com front point, this is the whole station block (including two-level domain name)!

This is only for the use of the site itself or plug-in implementation of the collection, for some professional collectors, there is no way.

Reprinted from: http://www.sjyhome.com/htaccess/limit-the-ip-address.html

. htaccess restricted access based on IP address

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.