I need a modification to an existing custom plugin that rewrites URLs. The plugin works so that an affiliate can append his unique ID to a Wordpress blog URL. All links, in the blog, in RSS and in comments must be rewritten according to rules as explained below.
Also, it must be flexible, so I that I can as many sites/links in one blogs as I want:
I should be able to rewrite URLs as follows:
original website in url-> site_id
affiliate number in URL -> affiliate_id
For example:
site_id=1234
[login to view URL] with links in the post to [login to view URL]
The links rewrite:
Wherever [login to view URL] is encountered in the blog, in RSS, or comments it will become
[login to view URL];p=2&w=1234567&c=0
The plugin should set a cookie with the affiliate ID. if a cookie with is already present, an affiliate ID in a URL has priority over the ID in a cookie. The affiliate ID should also be appended to all other internal and external links in both blog and all RSS, so that affiliates can see it everywhere, even when they examine the source code which can have links that are not normally visible, and so that visitors that are sent to the blog by an affiliate can never visit the end-URL without going through the [login to view URL] URL.
I will provide the existing custom plugin code after award of project.