Easier redirecting urls to another affiliate network

Using mod_rewrite to handle various content issues

Easier redirecting urls to another affiliate network

Postby ikke » Mon Oct 13, 2008 4:18 am

we would like to use urls like:
http://oursite.com?&a=websiteid&c=campa ... enceid&q=1

based upon the q= parameter the destination url should be determined (the q= will determine the outgoing url to the affiliate network we would like to work with)

Using q=1 to http://example1.com/click &a=websiteid, &p=campaignid &g=graphicid, &url=deeplink &epi=referenceid example: http://example1.com/click?p=19543&a=154 ... id%3D79062

see: in this example the visitor is redirected to http://example1.com/click and (amongst others) c=campaignid is being replaced with &p=campaignid. when we change the q=1 parameter to q=2 the visitor will be redirected to another url and the parameters are being renamed:

Using q=2 to http://example2.com/c/ &wi=websiteid, &si=campaignid &li=graphicid, &dl=deeplink (WITHOUT DEEP LINK DOMAINNAME) &ws=referenceid example: http://www.example2.com/c/?wi=1775&si=1 ... reference2

Using q=3 to http://clicks.example3.com/_c &aid=websiteid, &si=campaignid &c?_b=graphicid, &_m=deeplink &4dadvn=referenceid example http://clicks.example3.com/_c?z=1&aid=4 ... n=E-Adidas

Would be great if we can set this up!

Posts: 9
Joined: Fri Jul 11, 2008 5:53 am

Postby richardk » Mon Oct 13, 2008 9:36 am

Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{QUERY_STRING} ^(.*&)?q=1(&.*)?$ [NC]
RewriteRule ^$ http://example.com/new-url-1?%1%2 [R=301,L]

RewriteCond %{QUERY_STRING} ^(.*&)?q=2(&.*)?$ [NC]
RewriteRule ^$ http://example.com/new-url-2?%1%2 [R=301,L]

?%1%2 is the query string without q=n.
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Return to Content

Who is online

Users browsing this forum: No registered users and 1 guest