PHP redirection script FAQ




Default installation

Default installation, without changing script, database or folder names:


config.php

Configuration file, comments are added to describe what you need to change.
$basename : is the path to database, leave as is if you didn't change name of data folder and/or database name.
$refcheck : referral checking (bot filter), can be true or false, default is true.
$domain : enter here your domain name, if it is example.com, enter "example" .
$refagain : full url to folder where script is, i.e., http://www.YourDomain.com/go/ in default installation


.htaccess uploading instructions

.htaccess is included in archive, no need to edit. When uploading , if you are not sure how your FTP software is handling extensions, rename it to htaccess.txt. After it is uploaded, rename to .htaccess . On that way, you will be sure that htaccess is uploaded using text mode.


How it works

For example: Visitor clicks on friendly link http://yourdomain.com/go/example or http://yourdomain.com/go/example/ , both are supported.
.htaccess, in /go/ folder is rewriting /example to index.php?id=example

Now, script is looking at the first fields of rows in database to match "example" with "example" . When "example" is found, url in the second field of that row is used to redirect visitor. Third field in database is used only for a small description of url, not displayed anywhere.


Friendly links (htaccess)

Friendly links means that url used to call script is not like "go/index.php?id=example", instead, it is displayed on browser status bar (when mouse is over link) as "go/example"

Direct link to script is not displayed on page, it helps to attract more clicks and to cheat web scanners who are looking for scripts to attack.

If, from some reason, you can't use htaccess, rename/remove it and use direct link to script


Good bots and a bad bots (robots.txt and referral check)

If you are redirecting to affiliate links, search engines don't like that.
Search engine spiders will not follow your links if there is directive in robots.txt (included)

Bad bots are not obeying robots.txt, hence they are hammering redirection script day and night. To avoid headache with them, simple referral check is added. Most of those bad bots are not providing referral string, and they are redirected to error page. For visitor, who is coming from different domain, or from proxy (no referral string) on that error page, the same link is displayed, so visitor can continue, now is referral from your domain, and redirection is working normally.

Second error page is displayed when somebody is trying to list folder, or trying to guess script name, or simply link ID is not found in database. Both messages (errors) can be customized.


Database delimiter

Default delimiter is pipe (|) . If you need to change delimiter due to your existing base, edit script and change delimiter and fields according to your database. Script is simple and this is not a problem.


How to test

Upload test.html and follow instructions to test links.