Title: Conditional redirection
Last modified: May 19, 2020

---

# Conditional redirection

 *  Resolved [pvmatic](https://wordpress.org/support/users/pvmatic/)
 * (@pvmatic)
 * [6 years ago](https://wordpress.org/support/topic/conditional-redirection-3/)
 * Hi, I can not set plugin to redirect 1 url to another url based on user IP address.
 * For example, I want to redirect some page url ([https://domain.com/page-url/](https://domain.com/page-url/))
   to another domain ([http://domain1.com/page-url](http://domain1.com/page-url))
   if user IP address is 123.456.78.911 or to some other domain ([http://domain2.com/page-url](http://domain2.com/page-url))
   for all oither users.
 * Could I do that with this plugin?
    -  This topic was modified 6 years ago by [pvmatic](https://wordpress.org/support/users/pvmatic/).

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

 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [6 years ago](https://wordpress.org/support/topic/conditional-redirection-3/#post-12857540)
 * Please see ‘URL and IP’ match:
 * [https://redirection.me/support/matching-redirects/](https://redirection.me/support/matching-redirects/)
 *  Thread Starter [pvmatic](https://wordpress.org/support/users/pvmatic/)
 * (@pvmatic)
 * [6 years ago](https://wordpress.org/support/topic/conditional-redirection-3/#post-12857549)
 * I guess I should use “URL and IP – the user’s IP address is used to determine
   the match, in addition to the source URL”?
 * But when I set URL which shold be redirected and IP for which redirection should
   be made it does not work (redirection works for all other IPs).
 * Any idea how to solve this?
 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [6 years ago](https://wordpress.org/support/topic/conditional-redirection-3/#post-12857560)
 * Yes, as I said, you can use the ‘URL and IP’ match.
 * How does it not work? You say it doesn’t work for the specific IP, but does work
   for all other IPs. Have you got the logic the wrong way round?
 *  Thread Starter [pvmatic](https://wordpress.org/support/users/pvmatic/)
 * (@pvmatic)
 * [6 years ago](https://wordpress.org/support/topic/conditional-redirection-3/#post-12857617)
 * Source url: domain/email/
    Query Parameters: Exact match all parameters in any
   order Title: Some redirection Match: URL and IP IP: 123.45.678.91 When matched:
   REDIRECT to URL with HTTP code 301 – MOVED PERMANENTLY Matched target: [http://domain1/roundcube/](http://domain1/roundcube/)
   Unmatched target: [http://domain2/roundcube/](http://domain2/roundcube/) Group:
   Redirections Position: 0
 * Redirection works for all other IPs (diferent from 123.45.678.91) and redirects
   users to [http://domain2/roundcube/](http://domain2/roundcube/). But even users
   with specified IP (123.45.678.91) are redirected to unmatched target: [http://domain2/roundcube/](http://domain2/roundcube/)
   instead of matched target: [http://domain1/roundcube/](http://domain1/roundcube/).
 * So my logic is here but I do not know if I am wrong somewhere?
 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [6 years ago](https://wordpress.org/support/topic/conditional-redirection-3/#post-12946891)
 * If the redirect isn’t working then it is likely that the IP addresses are not
   what you expect, or that the server is not using the client IP (for example, 
   if you are behind a proxy of some kind).

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

The topic ‘Conditional redirection’ is closed to new replies.

 * ![](https://ps.w.org/redirection/assets/icon-256x256.jpg?rev=983639)
 * [Redirection](https://wordpress.org/plugins/redirection/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/redirection/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/redirection/)
 * [Active Topics](https://wordpress.org/support/plugin/redirection/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/redirection/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/redirection/reviews/)

## Tags

 * [IP](https://wordpress.org/support/topic-tag/ip/)
 * [url](https://wordpress.org/support/topic-tag/url/)

 * 5 replies
 * 2 participants
 * Last reply from: [John Godley](https://wordpress.org/support/users/johnny5/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/conditional-redirection-3/#post-12946891)
 * Status: resolved