• Resolved 9qksssldk

    (@9qksssldk)


    Hello!
    I have installed the plugin and everything works like a charm! This is the best country blocking plugin for WordPress available. I have only one problem. When I activate the plugin to block every country except mine, everything works well, but I want the blocked users to be redirected to a different domain (example.com/forbidden). But when I choose the response code to be 301 Moved Permanently and enter the Redirect URL and then test the website from other countries it starts a loop and it keeps accessing the wp-admin folder.
    I made the test via:
    https://tools.pingdom.com/
    Thank you very much! Awesome plugin!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author tokkonopapa

    (@tokkonopapa)

    Hi @9qksssldk,

    Thank you very much for giving ★★★★★ to this plugin!

    But when I choose the response code to be 301 Moved Permanently and enter the Redirect URL and then test the website from other countries it starts a loop and it keeps accessing the wp-admin folder.

    Sorry this issue. I implemented a logic to avoid “Redirect loop” but it seems not to work. Beside this issue, you can add “Allowed Redirect Hosts” via allowed_redirect_hosts filter hook because this plugin uses wp_safe_redirect().

    Please refer “Plugin API/Filter Reference/allowed redirect hosts“.

    One thing I should note is that when you choose “mu-plugins (ip-geo-block-mu.php)” as “Validation timing” in “Validation rule settings” section, you should add your code snippet not into your theme’s functions.php but into drop-in.php in geolocation API directory. Please refer to this document.

    Once I closed this thread as resolved, but please feel free to post something you need to this topic.

    Again, thank you!

    Plugin Author tokkonopapa

    (@tokkonopapa)

    Dear all,

    I add a new document at “allowed_redirect_hosts” in my codex.

    Please refer to it.

    Thanks.

    I have the same problem !

    Plugin Author tokkonopapa

    (@tokkonopapa)

    Hi @iswaribenoit,

    I have the same problem !

    Did you mean that you configured the response code as “301 Moved Permanently” and set a different domain into “Redirect URL“? And didn’t you register the domain via allowed_redirect_hosts filter hook?

    Then the same issue might happen.

    I already provide enough information in this thread. And I also never know about your skill of WordPress. Please include much information as possible. For example, what did you already do, and what didn’t you do by now.

    I appreciate your understanding.

    I way to test it localy, would be fine, s? I can see what others will see, but without blocking my self ??

    Allso can the redirect be to a page, on same site?

    Plugin Author tokkonopapa

    (@tokkonopapa)

    I’m sorry but I can’t get your point exactly. Do you want to know how do you test on local environment?

    If so, you have a different issue from mentioned here.

    You know a local server has its own IP address such as 127.0.0.1 or ::1 that are assigned to the loopback network interface on localhost. And the country code is not assigned to these.

    The easiest way to emulate a public server is to put the following code (just for example) into your wp-config.php (of course on your local server!):

    $_SERVER['REMOTE_ADDR'] = '98.137.149.56'; // yahoo.com

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘301 Redirection not working’ is closed to new replies.