How to allow access to a single IP address using .htaccess

Last modified: January 18, 2025
You are here:
Estimated reading time: < 1 min

In this example, if you want to allow access only to the IP address 1.2.3.4, the code you would add to your .htaccess file is:

# Order Allow, Deny

Deny from All

Allow from 1.2.3.4

The Order directive specifies the sequence in which the allow and deny rules are processed. In the above example, the Allow rule is processed first, followed by the Deny rule. This means access is allowed from the IP 1.2.3.4 and denied for all other users.

Was this article helpful?
Dislike 0
Views: 26

Braw Hosting Sales

Typically replies within a day

Hello, Welcome to the site. Please click below button for chatting me through Telegram.

Scroll to Top