When this plugin blocks a request, it behaves differently depending on the setting of the “Response code”. This document explains about the details and also how to customize the error page for human.
Response code and behavior
You can select a HTTP status code which is returned to the requester when blocking occurs.
This plugin behaves differently according to the code you selected as follows:
- Successful 2xx
Returns refresh Meta tag which encourages a browser to jump to the specific URL. Note that W3C does not recommend this tag because of back button. - Redirection 3xx
Returns the location header with the specific URL for URL forwarding. - Client Error 4xx / Server Error 5xx
Returns a simple html given bywp_die()
.See also Human friendly error page.
Redirect URL
You can specify the URL for response code 2xx and 3xx. Front-end URL on your site would not be blocked to prevent loop of redirection even when you enable “Front-end target settings”. Empty URL is altered to your home.
The default value is pointed to the “black hole server” where if the attackers actually redirect to that URL, they never get the result.
Response message
You can specify the message for response code 4xx and 5xx. The default value is:
Sorry, your request cannot be accepted.
Empty message is altered to what given by get_status_header_desc()
.
Human friendly error page
A human friendly error page is available instead of a dreary page by wp_die()
if you select 4xx for client error and 5xx for server error as a response code.
You can find 404.php
in your theme directory. Please copy it and give it a name according to the setting of “Response code”. The following picture is a sample of 403.php
in Twenty Twelve with BuddyPress.
"mu-plugins" (ip-location-block-mu.php)
as “Vaidation timing” at “Validation rule settings“, you have some restrictions on using custom filter hooks and human friendly error page. See also this codex.