Reciprocal Links Script | Link Exchange Script

Link Manager Software

Hold Everything!

I've been working diligently the last month on a complete revision of my reciprocal links script.

I've now added features that people have requested for quite some time. So, in addition to all the features you see below, the script will now include:

  • Categories: You can create as many categories as you wish.

  • Unique Content for Each Category: The HEAD and BODY are completely under your control. Add an article about "mortgages" to the reciprocal links page for "mortgages". Add an article about "credit cards" on the "credit card" links page. Make these pages look just like normal content from your website.

  • CRON Job: Approved links are now scanned for reciprocal links on a scheduled basis. New links pages are created from the current approved links. You can schedule these checks using the "cron" feature of your cPanel.

  • Automatic Links Update The email sent out when a reciprocal link is not found contains a link that the remote webmaster can use to enter a corrected reciprocal link URL. This can save you a lot of time updating the link data.

  • Email Verification: You can select to send an email to the link requester asking that they verify their proposed link request. This saves time by eliminating frivolous requests with invalid email addresses.

  • RSS Feeds: I've added code to insert any RSS feed into any category page. The RSS feed will update each time the links pages are created. Your frequently updated pages will be spidered by the search engines. This feature is similar to that of my Website Development Tool.

Of course these "reciprocal links" pages are real HTML, not generated on-the-fly. They are perfectly readable by any search engine.

You can get a preview of what your reciprocal links pages can look like by clicking to our Resources or

I have copied links from my old reciprocal links system to the new system so you can now see how the links appear.

Download a portion of the user's manual.

Free Full Version for Evaluators

This is a greatly revised edition of the reciprocal links script I've offered for several years.

I am looking for a few webmasters who will evaluate this reciprocal links management system.

If you are interested, please click on Reciprocal Links Script and provide some details of the site where you will use it.

Reciprocal links are links where:

  • I link to your site, and
  • You link to my site.

Reciprocal links can be two-way exchanges (where both sites link to each other) or three-way exchanges (where site "A" links to site "B", and site "C" links to site "A").

There are a number of reciprocal links scripts available. However, I found none that really met my needs for semi-automated server-based link manager software that had the features I wanted.

For example, some reciprocal link management software systems will produce dynamically generated pages. In such a system a link could move from one page to the next. I wanted link manager software that would generate real HTML pages and assign each link a permanent page location. This helps other webmasters easily verify that their link is on your site.

I thus wrote my own server-based PERL link manager software. These reciprocal links scripts will work on almost all Unix-based servers with PERL installed. To use the features of this script:

  • You must have a Google API key. This is free from Google.
  • Your server must have the SOAP::Lite module to use the Google API
  • Your server must have the LWP module to use more sophisticated "get" functionality in retrieving remote links pages

I will explain how this reciprocal links script works as we look at the following screens.

Reciprocal Link Exchange Request

The first screen below is what a person sees who wants to establish a reciprocal link exchange with your site. This is the bottom portion of the screen. The top portions explains what reciprocal links are and shows the way you want your link to appear on his site.

New Link Request Screen

Each of your reciprocal link pages links to this request screen. The link says "To add a reciprocal link to this page click here."

Your main index page would probably have a "Friends of ..." links at the bottom of your main page that link to one or more of your reciprocal links pages.

The lower portion of the reciprocal link request screen asks for information about:

  • URL of site or page you will link to
  • The text of the link or site name (you can limit the number of characters)
  • Description of site or page (you can limit the number of characters)
  • URL of page with a reciprocal link back to your site
  • Webmaster's name
  • Webmaster's email address

Initiating a Link Exchange

Suppose you want to participate in someone else's reciprocal link program. You will normally need to add a link to the other person's page before they will add a link to your page.

So, you'll start by filling out the form with information from their site.

Then, in the administrative script you will examine pending links. Their link status will show a status of "Missing." You will select the "OK" status button and their link will become approved. You'll then add their link to your links page when by selecting to generate your links pages.

Then you can fill out the reminder of the link request form on the other site.

Each of these fields is checked for validity. URLs and email address must be of the right form. Other fields must be within acceptable length limits.

In addition, only one link per domain will be accepted.

You can optionally choose to validate that the link page is on the same domain as the requested link URL. But this would eliminate 3-way links, so I normally allow links from other sites.

Error messages are presented in various screens that are not shown here.

Over time I began to encounter various automated scripts that kept submitting links over and over again. This was really annoying. I'd have a dozen or more links to evaluate every day which I already rejected just the day before. Something had to be done!

Optional Human Validation Code
Optional Validation Code

I added the optional requirement to type in a randomly generated sequence of 10 characters to get their link processed. This defeats automated script submission. You turn this on or off in the configuration file.

I turn it on only when one of my sites gets spammed by repeated automatic link requests day after day.

If you are like me, you get a number of link requests from sites that are not relevant to your site. I didn't want to keep rejecting casino or pharmacy sites. So, I created a list of words that should not appear in a link request. These words" now include URLs that seem to crop up but are useless for effective linking.

These are words that should not appear in the proposed URL, the link-back URL, or the title or description.

You can't imagine how many sites sell "propecia" or how may lovely "lolitas" there are out there! And, how many people out there really think I'm going to link to some silly site at "hometown.aol.com"?

And, please, don't bother to offer a reciprocal link from a site that is simply a link farm with no significant content of its own. Once I see such a site, I add the URL of the site to the "bad words" list so it can automatically be rejected next time.

I added this capability to weed out links I would reject anyway to save time. After someone enters their link information, my script checks their URLs, their title and description for these "bad words". If they are found in their submission, they view a message indicating that I typically don't exchange links with such sites.

You can optionally allow them to see the offending words.

So, in the configuration file, I added a place to put such "bad words" so sites can automatically be rejected.

Add Bad Words to the Configuration File
Save time

So, now someone who wants to exchange links with my identity-theft-help.us site can't offer unrelated sites.

For example, suppose someone offers a site about low cost airline tickets. Their link text is "Low Cost Airline Tickets " and they are offering a link back from www.net-informer.com. Here is what they would see:

Site Not Compatible
Not a Compatible Site

The best part, of course, is that I never have to see these failed requests. They don't waste my time.

And, can you believe it? Some people will offer a link to my site that someone else used for their link.

By checking my backlinks in Google or Yahoo! they found URLs linking to my site. These scoundrels then offered one of those URLs as "their" reciprocal link!

WOW! How many links had I already accepted that really didn't offer a unique reciprocal link?

My scripts now check for duplication reciprocal links twice:

  • During link submission they check for exact matches. You definitely want to eliminate these.
  • During approval they check for reciprocal links on the same domain.

Here is what a reciprocal link submitter sees if he tries to fool me:

Duplicate Links Message During Submission
Duplicate Link Detection

Well, after that, do any link exchange requests get through?

Of course, lots of valid, worthwhile requests are successfuly submitted.

And after successfully submitting a reciprocal link, the webmaster sees the "Thank You" screen. It again contains the type of link that should be added to his site.

Thanks for Link Request

Email Notification

After the Webmaster makes a successful request, an email is sent to you indicating that a new "pending link" has been added.

Here is was a sample email looks like:

Email Notification to Evaluate New Reciprocal Links
Pending Link Notification

The email has a link right to the administrative script. So, to evaluate new links, all you have to do to begin your evaluation is click this link.

This is especially nice if you use this script of several of your sites. Each email points to the right site.

Configuration File

The configuration file contains variables you'll need to customize your reciprocal links system.

The top half of the file contains variables you'll need to change while the bottom half contains variables that are pretty "standard".

Some variables you'll need to set include Unix paths and URLs of critical pages. You add your Google API Key (so backlinks can be checked). It also contains descriptions of your site and your email address.

You will need to edit some of the values displayed below prior to uploading the scripts and data files to your server. Details are presented in the "readme" documentation.

Section of configure.cgi file

##############################################################################
# You MUST change the following to customize these scripts to your needs
##############################################################################

# Your name as it will appear on emails
$myname = "Bob Sherman" ;

# Unix path to the location of links file with final slash
$linkspath = "/home/logonid/public_html/" ;

# My email address
$myemail = 'bobsherman@hotmail.com' ;

# Unix path to your mail program.
$mailprogram = "/usr/sbin/sendmail";

# My Google APIkey
# $APIkey = 'place your Google API key here' ;
$APIkey='1234567890abcdefghijklmnopqrstu';

# Minimum Google Back-links for acceptance as a reciprocal link partner
# Enter zero to accept all link requests
$minimumBacklinks = 7 ;

# Unix path to the CGI files
$pathtocgi = "/home/logonid/public_html/cgi-bin/" ;

# HTML path to the CGI files
$htmltocgi = "http://www.yourdomain.com/cgi-bin/" ;

# The URL to the directory containing your link pages (include the final slash)
$mylinkdirectory = "http://www.yourdomain.com/" ;

# Full URL of the admin.cgi script
$scripturl = "http://www.yourdomain.com/cgi-bin/admin.cgi";

# Full URL of the link request validation script
$linkrequest = "http://www.yourdomain.com/cgi-bin/linkrequest.cgi";

# Full URL of the link request script
$createlinkrequest = "http://www.yourdomain.com/cgi-bin/createlinkrequest.cgi";

# The following are details of your link requesters users should put on their links page
# My URL -- the URL to appear on their reciprocal links page
$myurl = "http://www.yourdomain.com" ;

# My page or site name
$mypagename = "Internet Money | Making Money Online" ;

# My page or site description
$mypagedescription = "Internet money: Covering every major subject you need to know about making money online." ;

# To add a link to the remote reciprocal link page adjust the following:
# Values: 0 - do not add a link
# 1 - add a link
$addreciprocallink = 1 ;

# Remote reciprocal link's link text
$reciprocallinktext = "Partner's link" ;

# Check backlinks when examining accepted links ( 0=NO 1=YES)
$checkbacklinks = 0 ;

# For a 10 character validation field in the link request script to prevent automated requests
# validation = "Y" for yes or "N" for no
$validation = "N" ;

# Look for my complete reciprocal URL
# When look for my URL in Accepted pages, look for the complete URL (includeding page)
# 'Yes" look for complete URL; 'No' Look for base URL ( e.g. http://www.mysite.com )
$lookforurl = 'No' ;

# Words not allowed in link text, description text or URLs (separate words by a comma)
$badwords = "amateur,incest,porn,mature,anal,nude,chicks,suck,cock,pussy,sexy,nipple, cialis,viagra,video,casino,blackjack,girls,taboo,weight,beastiality,swimsuit,propecia, female,models,tickets,blog,airline,xxx,lesbian,underwear,teen,vitamin,nutritional, supplements,sutra,lolita,horse,women,naked,asians,paris,hilton,blowjob,forumup.org,beep.com, halloween,costume,jack,cake" ;

# Display bad words to webmaster that are found in his link request
# 1 = Yes 0 = No
$displaybadwords = 1 ;

Not shown are additional options that you may want to change.

For example, twenty links will appear on each of your links pages. As more links are approved, they will be assigned to subsequent pages. One variable in the configuration file allows you to set the maximum number of links to appear on a page. This will affect newly approved links. Currently approved links do not change the page on which they appear.

The main menu has an option that displays this configuration file for you to view and edit. This allows you to edit the link text you use for your site or modify the "bad words" to more readily represent sites you wish to automatically reject.

Link Evaluation

The main administrative menu allows you to evaluate Pending or Approved links. You can see the main menu below:

Main Administrative Menu
Reciprocal Links Script Main Menu

Pending links are those that await your approval before they are accepted to appear on your links pages.

Approved links currently appear on your links pages.

You can review pending links whenever you want. Typically, you'll do that when you receive new "pending link" emails.

Less frequently you'll want to review approved links--just to make sure your URL still remains on their links page.

During the evaluation of a link, the page your link should be on is retrieved by the server and searched for your URL. If your URL is found on the link page it shows a status of "OK". If your URL cannot be found on the link page you see a status of "Missing".

After an Approved reciprocal link is missing during several evaluations, the Approved link is demoted to Pending.

After a Pending reciprocal link is missing during several evaluations, the Pending link is deleted.

You can update the configuration file to set the number of such failed evaluations before these actions are taken.

Evaluating Approved Links
Evaluating Approved Links

As you can see, both the site URL and the links page URL are links. Clicking these links brings the appropriate page up in a new browser window. If a link shows as "Missing" and you value the link, you may want to look at adjoining links pages and try to find your link on nearby pages.

If you find your link, you can replace the incorrect links page URL with the correct one and set the status to "OK".

Evaluating Pending Links

Evaluating Pending links is similar to evaluating Approved links. The same tests are performed on each link as are performed for Approved links.

The major difference is there will usually be more problems detected with Pending links.

Retrieval errors such as 404 page not found or 500 can't connect to site are displayed. In addition, warnings about duplicate links from the same domain are displayed.

Evaluating Pending Links
Evaluating Pending Links

Your Links Pages

This reciprocal links script creates multiple, real HTML links pages. Default page names are: links.htm, links1.htm, links2.htm, and so on. The configuration file allows you to set the "stem" name to any name you want, such as "partners" or "friends".

Some search engines may downgrade you for having too many links per page. Google, for example, suggest you have less than 100 links on a page. Two links are automatically placed on your page: a link to your link request script and a link to the location of this page where others can download this script. In addition, links to the other generated links pages appear near the bottom of the page.

Except for the links described above, you have complete control over the "look and feel" of the page. You can format the link section as a column in a table and place your own messages or ads in an adjoining column. You can add AdSense ads or other text or banners.

You can also control the META Tags in the heading.

Revise HTML Code on Your Links Page
Revise Look and Feel of Your Links Page

Here is a sample links page showing AdSense ads. AdSense ads appear on each links page.

Sample Links Page

Logon Screen

When you first click to the administrative script, you'll need to enter a password to gain access.

You can think of the password as a combination of logon ID and password. You can create a password such as "5552345678-nature". You can consider this in two parts: an old telephone number nobody knows but you, and a favorite subject you enjoy.

Initial Password Screen
Logon Screen

Obviously, anyone can run the administrative script. If someone does run it and attempts to enter an incorrect password more then three times, the script sends you an email and ends.

It also set the permission of the administrative script to non-executable so no further attempts can be made.

After you successfully enter a password, you will see the main menu.

Review / Update Link Information

You can review and change any information in the links database by selecting "Review / update links" from the main menu.

This will bring up the following screen:

Review / Update Links Database

The screen has the Website URL printed next to the input/update box for the URL. This allows you to search for the URL (or a portion of it) on this page. It really helps to locate the link you want to update when you have many links.

This screen allows you view or change:

  • Site URL
  • Site Name
  • Site Description
  • Links Page URL
  • Email address of webmaster
  • Name of webmaster
  • Type of Link (Pending or Accepted)
  • Status (1=OK, Less than 1=Not found)
  • Links Page (Starting with zero)

This option is especially helpful if another webmaster sends you an email requesting a change to his link text or description. You can make the change and generate new links pages very quickly.

See Links Sorted by URL

When you are actively looking for new links, it's really helpful to see a sorted list of the links you already have. By selecting "See links sorted by URL" from the main administrative menu you can easily tell you already have a link exchange with a site.

This option displays the link URLs with their link text.

Links Sorted by URL

Edit Email Messages

The reciprocal links system sends 8 different emails to webmasters about their links.

You have complete control over the content of those email messages.

Each message is stored in a separate file. You can edit these files within the administrative script. The purpose of each of these files is as follows:

  • goodlinks0.dat is typically sent when you are proposing a link exchange and have entered the link information yourself; this is a first contact message; the link moves to accepted status
  • goodlinks1.dat is typically sent for proposed links entered by other webmasters when your link is detected on their links page; the link moves to accepted status
  • goodlinks2.dat is sent when your link reappears on their links page after an absence

  • badlinks0.dat is sent if Proposed link's link page does not contain your link
  • badlinks1.dat is sent when an Accepted link's link page does not contain you link
  • badlinks2.dat is sent when an Accepted link's link page does not contain your link after several communications have been sent; the link becomes a Proposed link
  • badlinks3.dat - sent when a Proposed link's link page does not contain your link after several communications have been sent; the link is dropped from the database
  • badlinks4.dat - sent when you decline or delete a link

Within each email message you can place several generic codes. These generic codes will be replaced in the emails by the information indicated. This information comes either from the configure.cgi file (described above) or from the information the webmaster submitted.

These generic codes help personalize the emails, making them look more professional.

Here is the screen for updating emails from one of my sites:

Edit Email Messages
Edit Emails

Summary

Here are some of the features of this script:

  • Allows both traditional reciprocal as well as 3-way links
  • Automatically sends emails to webmasters when you approve or reject a proposed link
  • Automatically sends emails to webmasters when their link to your site is not found
  • Allows you to configure emails to webmasters with fields in the database
  • Uses the Google API to determine the number of backlinks to proposed websites
  • Allows you to specify the minimum number of backlinks a site must have to successfully request a reciprocal link
  • Creates real HTML links pages
  • Allows you to specify the content and format of your links pages
  • Allows you to specify the maximum number of links on each links page
  • Allows you to place link pages in any directory of your site
  • Allows you to display links as HTML links or JavaScript links
  • Allows you to place the reciprocal link scripts in any directory of your site
  • Add link to all the other reciprocal links pages on each reciprocal links page.
  • Allows you to add links to the pages linking back to your site
  • Provides an optional random 10 character field that helps defeat automated link request scripts
  • Allows you to automatically reject sites with specified domains or whose title or description contains specified words
  • Allows you to reject 3-way links where the reciprocal link is on a domain different from the domain you are to link to
  • Allows you to specify the name stem of your reciprocal links pages
  • Allows you to specify the number of times you will not find your link on a remote site before the proposed link is dropped or an accepted link is demoted to proposed status
  • Allows you to specify the maximum description length you will accept
  • Allows you to specify the maximum link text length you will accept
  • Allows you to view remote sites or remote links pages in a new browser instance
  • Allows you to back up your links database to another file on your server
  • Allows you to restore a backed up links database to the current database
  • The proposed link script verifies that a valid email address is entered
  • The proposed link script verifies that valid URLs are entered


You can see how the script works by adding a reciprocal link to your site at any of the following locations:


NOTE: Do not think that by simply putting this (or any other) reciprocal links script on your site that you will quickly obtain hundreds of relevant link requests.

You must take affirmative action. You can't sit by and wait for others to come to your aid. Use several search engines to look for existing sites that already offer reciprocal links. Search for sites with a keyword relating to your site AND the word "reciprocal". Probably 10 to 20% of the sites you locate will be appropriate for exchanging links.

You must request a reciprocal link from the relevant sites you find with the search engines. These sites often want you to add a link to their site on your links page first. Enter their information using the createlinkrequest.cgi script.

The admin.cgi script allows you to place links to other sites on your links.htm page before they place your links on their links page. In the administrative script, review the pending links and set the link status of these sites to "OK." This "approves" their links and allows those links to appear on your links page. Then generate the links page from the admin menu.

How do you find other sites? You can find them by doing searches using Google or other search engines.

Or, you can use a service that matches sites that want to exchange links. One such service is the SiteSell Value Exchange. This service registers your site as one that is willing to exchange value with other sites that have a similar theme/topic content (the engines weight the value of a link less heavily if the linking site is not of a similar nature to yours -- so why bother with any other kind of site?). It simultaneously searches for similar sites, ones with topical content that relates to yours.

You can also search for relevant sites and register your site at reciprocal link directories such as http://www.reciprocallink.com/. Eventually, other Webmasters looking for reciprocal links will find your site and begin requesting reciprocal links from you.

Also, not all links from remote sites to your site are of equal value. Links from "link farm" sites having hundreds of links are sometimes ignored by search engines or may even cause your site to decrease in perceived importance.

For Google, Page Rank is critically important. Pages with high page rank that link to your page increase Google's estimate of the value of your page--making it appear higher in search results. Get the Google Toolbar to display "Page Rank" of each site you visit. You can then select to exchange links with only those pages having a "good" Google page rank.

External Resources