Jump to content

Need a little script help......


bigkee42

Recommended Posts

Hello,

 

I am Keon and I am new to the forum and PHP.  I found a neat script, but I can not get it to work.  I will add the whole blog below:

 

 

 

Affiliate link cloaking with Geo targeting

 

If you have some experience in affiliate marketing you know why is so important to cloak mask your affiliate links from bots and humans. If not you can find some info here.

 

Another problem you can face is losing some of your visitors because some of affiliate networks do not allowed traffic from some countries and redirect to different offer without your affiliate ID, so you won’t get your commission. Or you want to redirect user to different landing page/offer depend on region he came from using the same link.

 

To solve both of this problems I’ve wrote redirect script with geo targeting and it’s time to release it to public.

 

Configuration:

In config.inc.php you have to define rules and your affiliate links. There is two type of rules.

 

GEO regular expressions:

 

    * Redirect to destination URL if user came from following countries: ‘/[(US|CA|GB)]/’

    * Redirect to destination URL if user not came from following countries: ‘/[^(US|CA)]/’

 

Static links: link:offer1, link:offer2, etc.

Empty rule: default URL if none of rules above matched

config.inc.php:

 

<?php

$config = array(

'geo:/[(US|CA)]/'  => 'http://example.com/aff-offer1',

'link:offer1'      => 'http://example.com/aff-offer2',

'link:offer2'      => 'http://example.com/aff-offer3',

''                  => 'http://example.com/def-offer',  # default offer

);

?>

 

In your httpd config file/.htaccess add following lines:

 

RewriteEngine On

RewriteRule ^/r/(.*?)/?$    /redirect.php?link=$1  [QSA,L]

 

In your robots.txt you disallow redirect script /r/:

 

User-agent: *

Disallow: /r/

 

Available country codes:

 

“AP”, “EU”, “AD”, “AE”, “AF”, “AG”, “AI”, “AL”, “AM”, “AN”, “AO”, “AQ”,

“AR”, “AS”, “AT”, “AU”, “AW”, “AZ”, “BA”, “BB”, “BD”, “BE”, “BF”, “BG”, “BH”,

“BI”, “BJ”, “BM”, “BN”, “BO”, “BR”, “BS”, “BT”, “BV”, “BW”, “BY”, “BZ”, “CA”,

“CC”, “CD”, “CF”, “CG”, “CH”, “CI”, “CK”, “CL”, “CM”, “CN”, “CO”, “CR”, “CU”,

“CV”, “CX”, “CY”, “CZ”, “DE”, “DJ”, “DK”, “DM”, “DO”, “DZ”, “EC”, “EE”, “EG”,

“EH”, “ER”, “ES”, “ET”, “FI”, “FJ”, “FK”, “FM”, “FO”, “FR”, “FX”, “GA”, “GB”,

“GD”, “GE”, “GF”, “GH”, “GI”, “GL”, “GM”, “GN”, “GP”, “GQ”, “GR”, “GS”, “GT”,

“GU”, “GW”, “GY”, “HK”, “HM”, “HN”, “HR”, “HT”, “HU”, “ID”, “IE”, “IL”, “IN”,

“IO”, “IQ”, “IR”, “IS”, “IT”, “JM”, “JO”, “JP”, “KE”, “KG”, “KH”, “KI”, “KM”,

“KN”, “KP”, “KR”, “KW”, “KY”, “KZ”, “LA”, “LB”, “LC”, “LI”, “LK”, “LR”, “LS”,

“LT”, “LU”, “LV”, “LY”, “MA”, “MC”, “MD”, “MG”, “MH”, “MK”, “ML”, “MM”, “MN”,

“MO”, “MP”, “MQ”, “MR”, “MS”, “MT”, “MU”, “MV”, “MW”, “MX”, “MY”, “MZ”, “NA”,

“NC”, “NE”, “NF”, “NG”, “NI”, “NL”, “NO”, “NP”, “NR”, “NU”, “NZ”, “OM”, “PA”,

“PE”, “PF”, “PG”, “PH”, “PK”, “PL”, “PM”, “PN”, “PR”, “PS”, “PT”, “PW”, “PY”,

“QA”, “RE”, “RO”, “RU”, “RW”, “SA”, “SB”, “SC”, “SD”, “SE”, “SG”, “SH”, “SI”,

“SJ”, “SK”, “SL”, “SM”, “SN”, “SO”, “SR”, “ST”, “SV”, “SY”, “SZ”, “TC”, “TD”,

“TF”, “TG”, “TH”, “TJ”, “TK”, “TM”, “TN”, “TO”, “TP”, “TR”, “TT”, “TV”, “TW”,

“TZ”, “UA”, “UG”, “UM”, “US”, “UY”, “UZ”, “VA”, “VC”, “VE”, “VG”, “VI”, “VN”,

“VU”, “WF”, “WS”, “YE”, “YT”, “YU”, “ZA”, “ZM”, “ZR”, “ZW”, “A1″, “A2″, “O1″

 

 

 

I uploaded the information to my domain, but I am not sure what I need to edit to make it work???  Also, I am not sure if I need to change any of the files CHMOD???  Please help

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.