Title: 301 Redirection not working
Last modified: March 30, 2017

---

# 301 Redirection not working

 *  Resolved [9qksssldk](https://wordpress.org/support/users/9qksssldk/)
 * (@9qksssldk)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/301-redirection-not-working/)
 * 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/](https://tools.pingdom.com/) Thank you very much!
   Awesome plugin!

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * (@tokkonopapa)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/301-redirection-not-working/#post-8975124)
 * Hi [@9qksssldk](https://wordpress.org/support/users/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()`](https://codex.wordpress.org/Function_Reference/wp_safe_redirect).
 * Please refer “[Plugin API/Filter Reference/allowed redirect hosts](https://codex.wordpress.org/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](http://www.ipgeoblock.com/codex/validation-timing.html).
 * 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](https://wordpress.org/support/users/tokkonopapa/)
 * (@tokkonopapa)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/301-redirection-not-working/#post-8987225)
 * Dear all,
 * I add a new document at “[allowed_redirect_hosts](http://www.ipgeoblock.com/codex/allowed_redirect_hosts.html)”
   in my codex.
 * Please refer to it.
 * Thanks.
 *  [iswaribenoit](https://wordpress.org/support/users/iswaribenoit/)
 * (@iswaribenoit)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/301-redirection-not-working/#post-9140966)
 * I have the same problem !
 *  Plugin Author [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * (@tokkonopapa)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/301-redirection-not-working/#post-9141981)
 * Hi [@iswaribenoit](https://wordpress.org/support/users/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](https://make.wordpress.org/support/handbook/forum-welcome/#include-as-much-information-as-possible).
   For example, what did you already do, and what didn’t you do by now.
 * I appreciate your understanding.
 *  [vedsegaard](https://wordpress.org/support/users/vedsegaard/)
 * (@vedsegaard)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/301-redirection-not-working/#post-9142262)
 * 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](https://wordpress.org/support/users/tokkonopapa/)
 * (@tokkonopapa)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/301-redirection-not-working/#post-9145294)
 * 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](https://en.wikipedia.org/wiki/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.

 * ![](https://ps.w.org/ip-geo-block/assets/icon-128x128.png?rev=1148568)
 * [IP Geo Block](https://wordpress.org/plugins/ip-geo-block/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ip-geo-block/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ip-geo-block/)
 * [Active Topics](https://wordpress.org/support/plugin/ip-geo-block/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ip-geo-block/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ip-geo-block/reviews/)

## Tags

 * [301 redirect](https://wordpress.org/support/topic-tag/301-redirect/)

 * 6 replies
 * 4 participants
 * Last reply from: [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/301-redirection-not-working/#post-9145294)
 * Status: resolved