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
有帮助吗?

解决方案 3

I figured it out

ErrorDocument 403 /error/403.html

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

其他提示

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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top