Subdomain Link Cloaking
May 24th, 2006
A common practice at the moment is to shorten affiliate links into a more useable format. For example, I have an affiliate link for 123-reg.co.uk which is http://www.123-reg.co.uk/affiliate.cgi?id=AF106554. However, if I want to share that link with someone, I have to login to my control panel, and get the link. It would be a lot nicer if I could offer a more memorable link like ukdomains.jellyandcustard.com.
This is in fact very easy to set up, however for those of you on shared hosts (without access to httpd.conf) your host will need to aid you in one or two steps.Here's how I did it:
- First up, you need to be able to accept all traffic to your domain's subdomains. You need to create a wildcard DNS record for your subdomains - in this case *.jellyandcustard.com. If you have no idea how to do this, then the best step is to contact your webhost, who will be able to assist you.
- Second up is to let your webserver know that you are accepting all traffic for your subdomains. This can be done in your apache httpd.conf by adding
ServerAlias *.domain.comto your site's Virtual Host. If you do not have root access to your webserver, chances are you will have to get your host to add this in. - Finally, once this is done, you can start utilising the subdomains by using mod_rewrite in a .htaccess file. Here's what I've done for ukdomains.jellyandcustard.com:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^ukdomains.jellyandcustard.com$ [NC]
RewriteRule ^(.*)$ http://www.123-reg.co.uk/affiliate.cgi?id=AF106554 [L,R=302]
Simply rinse and repeat for any other domains that you need. Wonder if it actually works? Give it a try! You do not need to repeat the RewriteEngine On line once it has already been added.
Add to del.icio.us
Digg this
Technorati
Related Posts:
- Determining if a URL exists with Curl
- Slow SCP Speeds
- Using DirectoryIterator to List Files in PHP
- Domains: The Good, The Bad, The Ugly…
Entry Filed under: Apache
3 Comments Add your own
1. imarketing manager | May 26th, 2006 at 10:11 am
Great Work
2. Paul | November 12th, 2006 at 8:55 pm
Jee,
I found a great 'jump' script which I use for all my affiliate links, so what I get is this:
http://www.your-business-online.com/jump.php?m=Niche Creator
I then have a simple php file where the affiliate url's are listed along with their short name and that's it, simple as.
3. Network Support Uk | April 20th, 2007 at 8:31 pm
What about a simple 302 redirect in your .htaccess?
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed