Being able to customize the appearance of your URL can help with both conversation as well as simplicity. Personalized URL’s (especially with affiliate links) are growing in popularity! This little trick not only personalized the URL (also called a PURL), but simplifies it, too. (And it looks very cool!)
This is so cool and I just wanted to share this little trick with you today!
(Yes, this is geek-stuff and does require some technical know-how!)
This is what I want to do:
I want to take the subdomain of a URL and redirect it (using an htaccess file) to a php file as a variable. Here is the example:
http://Mattie.recommends2.me
I want this to redirect to:
http://recommends2.me/index.php?affname=Mattie
By using the subdomain, I am able to do a few things:
- Personalize the link (called a PURL in affiliate marketing)
- Shorten the link
- Simplify the link
(And it looks and sounds cool!)
There are two things I needed to do to make this work:
1) Create a DNS A Record for *.recommends2.me pointing to my own IP address.
Some systems may allow you to point to a generic 127.0.0.1 address, but with Pair Networks, I needed to assign recommends2.me a dedicated IP and point directly to that IP address.
Realize that your server company may do things differently. Since my dedicated server is with Pair Networks, this is the set-up that is required.
Some servers may not allow for the wildcard (*) record and may require you to manually assign each subdomain. (That kind of sucks and this will not work!) With my Pair Networks configuration, I can create the subdomain in this virtual way without creating manual subdomains or additional A Records.
2) Edit Your .htaccess file
From here, it is even easier! Simply add the following lines of code to your htaccess file:
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^(.+)\.recommends2\.me
RewriteRule .* http://recommends2.me/index.php?affname=%1 [L,R]
Few things to point out above:
- The first conditions specifies to ignore the redirect if the URL starts with “www”, like http://www.recommends2.me.
- The second condition is grabbing the subdomain as a variable.
- The final line is the actual rewrite where the subdomain variable is assigned as a php variable (%1).
- Do NOT put parentheses () around the .* in the RewriteRule!
- Be sure to replace recommends2.me with your own URL!
That is it! From here, you can use a standard PHP $_GET variable to retrieve the data. Try it out yourself and see what you think:
(This specific variable “Mattie” is a test case. Other variables here will redirect to other sites.)
Cheers…matt
|
Don't Buy Another Money Making Product Until You Watch These FREE Videos! |
My name is Matthew Bredel and as of March, 2007, I am a full-time, work-at-home internet marketer.
For close to 10 years, I worked for a defense company which was an OK job, but I was so uninspired in life and frankly, I needed some more money. That is when I first discovered internet marketing! Now I admit that I didn't start making thousands in my first couple of months (in fact, I lost my shirt!), but I finally saw the "internet light"...
This also works great for sending mail to your own list, and creating “personalized” Sales pages.
E.G. “Hey Steve, check this out. I put together a special review page for you to learn about these awesome blue widgets!
“http://Steve.bluewidgets.com”
Then you just add php to the page that pulls the GET variable from the URL
<! —- $name = $GET['affname'];
Hi
Check out these awesome blue widgets….
—!>
September 2nd, 2009 at 1:11 pm
Hey Buddy! Good to hear from ya! And YES, personalized URLs (or PURLS) work GREAT with physical mail (both from from a trust as well as a conversion stand-point…plus, it is a lot easier to remember! cheers…matt
September 4th, 2009 at 1:20 pm