Turn a 404 Error into an Affiliate Program
If you've managed a web site for a long time then I'm sure you're familiar
with custom 404 pages. If a visitor types in the wrong URL or comes to your
site through a bad link, you can send a user to a special area.
You can take this a notch up and turn a 404 error into an affiliate program.
This is really useful on a Direct Response Marketing site, where you probably
only have a couple of pages anyway.
For example, let's say your site is something like http://www.example.com.
You have a Clickbank affiliate with the ID "joe". Wouldn't it be cool if he
could just promote the URL http://www.example.com/joe instead of some
long and messy Clickbank hoplink?
(I have used this method in the past when I wanted to promote multiple products
from one Clickbank account, but didn't want to sign up for a separate account
for each one.)
Open up a new text file and place this code in:
RewriteEngine on
# if the request is not a directory, file, or link to another file
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
# substitute the "filename" into a clickbank hoplink with you as the affiliate
RewriteRule (^|/)([A-Za-z0-9]+)(/)?$ http://hop.clickbank.net/?$1/SellerClickbankID [redirect=permanent,last]
The important part: Replace "SellerClickbankID" with your actual Clickbank ID.
Save this file as ".htaccess" (with the dot in front), and upload it to the
top level of your web site.
The way this works is really simple. First of all, the URL will only be rewritten
if the file that's requested does NOT exist on your site. If the affiliate's
name is "joe" and you have a folder named "joe" on your site, that joe folder
will be loaded instead of Joe's Clickbank hoplink.
Also, this redirect will only apply if the "filename" (the last part of the
file) contains only letters and numbers. That means no periods or anything
like that. So if the url loaded was http://www.example.com/joe it would work,
but http://www.example.com/joe.html would
not because for all we know the visitor is looking for a legitimate file. (This
is intentional.)
And finally, trailing slashes will work, so if an affiliate promotes http://www.example.com/joe/ (notice the
slash at the end) the redirect will still happen. So this behaves as closely
as possible to an actual redirect.
Even if you don't use Clickbank as the affiliate program for your product, you
can still adapt it to your needs. Take a look at the second part of the last
line in that HTACCESS file:
http://hop.clickbank.net/?$1/SellerClickbankID
The $1 is the place where the affiliate's ID is substituted in. So in this
case if the affiliate ID was "joe" and you set your seller ID in the HTACCESS file
to "simplephp," the redirect would look like:
http://hop.clickbank.net/?joe/simplephp
And remember, after sending the user to Clickbank they'll be directed right back
to your landing page, with the customer cookied in to the affiliate, giving that
referrer proper credit for the sale.
Experienced PHP/JavaScript Tutor
Solves 19 Of Your Most Frustrating
Direct Response Sales Page Hang-Ups
Salespage Tactics
Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/scottpar/public_html/desktop-wealth/res/webmaster/!end-extra.htm on line 2
Warning: include(http://www.Desktop-Wealth.com/res/rss2html/computer-rss2html.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/scottpar/public_html/desktop-wealth/res/webmaster/!end-extra.htm on line 2
Warning: include() [function.include]: Failed opening 'http://www.Desktop-Wealth.com/res/rss2html/computer-rss2html.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/scottpar/public_html/desktop-wealth/res/webmaster/!end-extra.htm on line 2