Restrict access by IP address via .htaccess

Using .htaccess, you can allow access to a website, file, or directory only from selected IP addresses.

Important: always set Require all denied first, then allow specific IP addresses using Require ip ....

A) Restrict the whole website

In the root .htaccess file:

# Allow website only from one IP
Require all denied
Require ip 213.81.175.210

# If you need to allow multiple IP addresses:
Require all denied
Require ip 1.2.3.4 111.222.333.444

B) Restrict only a specific file (for example xyz.php)

If you want to restrict only one file (and not the whole website), put this into .htaccess:

<Files "xyz.php">
Require all denied
Require ip 1.2.3.4
</Files>

C) Restrict only a specific path/directory (for example /admin)

Create (or edit) an .htaccess file inside the /admin directory:

Require all denied
Require ip 1.2.3.4

Note: replace sample IP addresses with your own allowed IP addresses.

helpdesk

we are ready to help

currently online

agents online 2 / 6

Platon Technologies

How can we help you?

We accept problem reports and any other feedback related to the use of our products and services.

 

helpdesk@platon.net +421 222 111 321

In case you need any help, contact us by e-mail or by phone.

  • By phone from 8:30 - 17:30
  • Sometimes even on weekends
  • Simple human approach
  • Even complex problems solved
contact form

Give our online help center a try. You will find more than:

  • 6 categories
  • 60 manuals
  • 23 e-mail settings
  • 8 programming tips
go to help center

Questions about our products or any specific request? Contact us.

We are checking whether the message is spam. Please wait...

Thanks for your message

If necessary, we will contact you.

Sending the message failed

Please contact us at helpdesk@platon.net.

NEWSLETTER

Thanks for subscribing

Subscription has failed