Support » Plugin: Redirection » How to redirect based on IP ?

  • Resolved emadfathy

    (@emadfathy)


    Hello There,

    I’m working on website on a live domain. I want all other visitors except me to be redirected to the page /soon/ if they asked for any page. In the same time I want to be able to access every page normally without redirection (whether I’m logged in or not).

    I’m thinking I need to make a conditional rule with my IP address. How could this be done with the redirection plugin ?

    Thank you in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author John Godley

    (@johnny5)

    Thank you @johnny5 for your reply. I want to add some clarification.

    I have one rule with these parameters

    Source URL: ^.*
    Match : URL and IP
    (and I put my IP in the list)
    When matched: Redirect to URL
    Matched Target : empty
    Unmatched Target: /soon/

    This rule works fine for my IP and the all site pages are opened for me, but for other IPs I got error ERROR_TOO_MANY_REDIRECTS, means it enters a loop of redirection.

    Do you suggest a modification to the current rule or adding another rule to stop looping ?

    Plugin Author John Godley

    (@johnny5)

    Yes, your regular expression also includes the target. You will either need to modify the regular expression to exclude /soon/, or you can add a ‘do nothing’ for /soon/ and make this a higher priority so requests to /soon/ will not be redirected.

    https://redirection.me/support/redirect-actions/

    Adding another rule with the

    Source: /soon/
    Match : URL only
    When Matched : Do nothing
    Position: 0

    didn’t fix the problem.

    Cloud you please provide the regex to exclude /soon/ from the source (all pages but not /soon/)?

    Plugin Author John Godley

    (@johnny5)

    Can you give a URL to test? The ‘do nothing’ will work.

    If you want to modify the regular expression you will need to come up with your own modification, using something like https://regex101.com to test it – regular expressions are not specific to Redirection.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to redirect based on IP ?’ is closed to new replies.