Does anybody knows how to create redirection script according to user's IP

8 replies
Hi guys,
I need a script which will redirect users to appropriate URL according to their IP address once they click link or button. Does anybody can share such script and explain how to implement it in wordpress site?

Thanks in advance!
#create #redirection #script #user
  • Profile picture of the author David V
    Originally Posted by diamondoleg View Post

    Hi guys,
    I need a script which will redirect users to appropriate URL according to their IP address once they click link or button. Does anybody can share such script and explain how to implement it in wordpress site?

    Thanks in advance!
    You could certainly use php or htaccess but the manual labor to keep adding users ip's would be a little ridiculous.
    It would far more efficient to be able to just enter an ip and a page and hit save.

    This plugin should do what you want. Read the directions, there are many things you can do with the plugin and redirecting based on ip is one of them.
    {{ DiscussionBoard.errors[7748454].message }}
    • Profile picture of the author diamondoleg
      Originally Posted by David V View Post

      This plugin should do what you want. Read the directions, there are many things you can do with the plugin and redirecting based on ip is one of them.
      Hey David,
      Thank you for answer!
      I installed this plugin that you suggested but i don't see anywhere the option which allows to redirect according to IP. Can you tell me where this option?

      Thanks!
      {{ DiscussionBoard.errors[7748553].message }}
      • Profile picture of the author David V
        Originally Posted by diamondoleg View Post

        Hey David,
        Thank you for answer!
        I installed this plugin that you suggested but i don't see anywhere the option which allows to redirect according to IP. Can you tell me where this option?

        Thanks!
        That's why I pointed out to make sure you read the instructions in the readme.txt, you will find more details in there.

        By the author:
        You can add your own code logic before and between any of the plugin's normal redirect checks if needed. See Other Notes / How to Extend for documentation. Some examples include: redirecting the user based on their IP address; and redirect users to a special page on first login.
        {{ DiscussionBoard.errors[7748608].message }}
        • Profile picture of the author diamondoleg
          Originally Posted by David V View Post

          That's why I pointed out to make sure you read the instructions in the readme.txt, you will find more details in there.
          Yes, now i see that there is an option to do that! It is piece of code which i have no idea where to insert. I understand that it might be solution for you when you find this code but for me it is like "ok, i see here is written a code to redirect to a specific URL for only a specific IP" but what i should do with it, i have no idea. I'll appreciate if you can guide me on how to use this code to make it work.

          Thanks a lot!
          {{ DiscussionBoard.errors[7748684].message }}
  • Profile picture of the author David V
    Ok, the php in the readme.txt needs to be completed according to what you want to do. I don't have time to do that tonight, but perhaps tomorrow (or someone else will?) post it for you and tell you where to place it.
    There are some advanced (and premium) plugins that do what you want as well as geo redirection. Are you just looking to redirect a certain user by his ip according to country/location, or is this a member your redirecting?
    {{ DiscussionBoard.errors[7748705].message }}
    • Profile picture of the author diamondoleg
      Originally Posted by David V View Post

      Ok, the php in the readme.txt needs to be completed according to what you want to do. I don't have time to do that tonight, but perhaps tomorrow (or someone else will?) post it for you and tell you where to place it.
      There are some advanced (and premium) plugins that do what you want as well as geo redirection. Are you just looking to redirect a certain user by his ip according to country/location, or is this a member your redirecting?
      I'll very appreciate it!!
      I think i explained not clearly myself in the beginning. What i need is geo redirection according to IP address of my visitors. I probably made a mistake when i sad "users".

      Yeah, so i have a CPA affiliate site. And as you know with CPA offers they have a different landing page for each country. So what i want to do is just not to lose money on those visitors who are not from US but redirect them to the appropriate landing page according to their IPs after they clicked the "call to action"

      Thanks so much David!
      {{ DiscussionBoard.errors[7748718].message }}
  • Profile picture of the author David V
    Ok, that changes things.
    You really should use a geo redirection plugin.
    There are tons of them out there.

    If you want a free one, search WordPress.org/extend/plugins
    If you don't mind paying search codecanyon.net/category/wordpress
    {{ DiscussionBoard.errors[7748780].message }}
    • Profile picture of the author diamondoleg
      Originally Posted by David V View Post

      Ok, that changes things.
      You really should use a geo redirection plugin.
      Thanks a lot for information!

      What would you suggest to use? Free or paid? One more thing, i heard that there is some site called "maxmind" which somehow relates to all of this redirection procedure. Can you tell me how it relates to that?

      Thank you David!
      {{ DiscussionBoard.errors[7748802].message }}

Trending Topics