Question

I tried to block an ip in the .htaccess, which I could do but I can't get the default 403 error to redirect to my custom 403 page.
Anyone know how to do this?

ErrorDocument 403 /403/403.html
Was it helpful?

Solution 3

I figured it out

ErrorDocument 403 /error/403.html

order allow,deny 
deny from xxx.xxx.xxx.xx
allow from all 

OTHER TIPS

You might be denying access to the file when you block the IP in the .htaccess file.

Create another .htaccess file inside the 403 directory and in that .htaccess allow all from anyone. Then anyone should be able to see the custom 403.html page when they are blocked.

See if that will help your issue.

Update:

Here is an example.

Put the error document line in the root .htaccess file.

ErrorDocument 403 /403/403.html

Then in the .htaccess file inside the 403 directory add only this.

Order allow,deny
Allow from all
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top