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:

  1. 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.
  2. 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.com to 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.
  3. 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:

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

Required

Required, hidden

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


Calendar

May 2006
M T W T F S S
« Apr   Jun »
1234567
891011121314
15161718192021
22232425262728
293031  

Most Recent Posts