0

I want to block users from India from the website and redirect them to a custom 403 page. Here's the code that i placed in .htaccess file:

ErrorDocument 403 /403.html

deny from 1.6.0.0/15
deny from 1.22.0.0/15
deny from 1.38.0.0/15
deny from 1.186.0.0/16
deny from 1.187.0.0/16
deny from 5.10.69.96/29
deny from 5.10.70.56/30
deny from 5.10.72.128/29
deny from 5.10.75.184/29
.
.
.
deny from 5.10.86.228/30
deny from 5.10.88.24/29

The ip blocking is working fine but it's redirecting to default 403 error page. Also if i manually enter the 403 error page in the url it's accessible but its not redirecting by default when i hit the domain

  • "if i manually enter the 403 error page in the url it's accessible" - But are _you_ visiting from one of the IP addresses you are blocking? – MrWhite Dec 22 '20 at 10:27

1 Answers1

1

When you block access to all content, you also block access to the custom 403 error page....

Bob
  • 5,805
  • 7
  • 25