Ever wanted to redirect visitors from different countries to different areas or pages on your website based on their country? This script will help you do it.
Basically, it uses an IP to country database to determine the country your visitor is in and will then redirect that visitor to a page or directory of your choice based on the country your visitor is in. The script also has a default mode for "everything else" to avoid having to set up a page for each and every country.
The way it works is to replace your main "index.???" (index.htm, index.html, index.php etc) page with a script created by this application that acts as the main redirector. Your server must support either an index.pl or an index.cgi as the default page. If it does not, this script will not work.
The following Perl Modules are required by the script. Except for one, all of the others should be standard. Ask your web host to install the Geo::IPfree module if they do not have it installed. (If you have root access you can install the module yourself. You will find the
Geo::IPfree module here).
Open the file "password.txt" with a text editor (like Notepad - DO NOT use Word or a Word processor!!) and change the password to something else. MAKE SURE YOU USE A SECURE PASSWORD. "Bob123" is not a secure password!
UPLOAD auto-redirect-admin.pl and password.txt in ***ASCII mode*** to your
home folder (/) on your website.
MUST BE ASCII mode or you will get a "Server 500" error when you
try to run it.
If a .pl extension does not work, try renaming it to .cgi. If that does not work, you're out of luck and have a web host that hasn't read the CGI specification dating back some 20 years.
If you are on a Windoze server, it may not work at all.
Server must have specific Perl modules installed. The script will tell you if they are missing. It will not work without them. Get your Web Host to install them if they are missing.
Now browse to http://your-domain.com/auto-redirect-admin.pl and enter your password after refreshing the page once.
You should see the "DB Download" button. Click it to get the latest copy of the database uploaded to your server. (the file is about 600k big so on most servers it should download in a second or two).
RENAME your index.??? page to something else and make sure there are no other index.??? files that may take precedence over the one the script will be creating.
(Some web hosts allow many different filenames/extensions for the default page. For example default.htm or home.php etc ... whatever it is, you need to ranme it to a file that is NOT regarded as a "default" page)
Read the on screen instructions and configure the script.
Save the configuration and create the index.pl or index.cgi file. This now becomes your websites main "home" page.
NOTE: in the "Setup redirection per country" section, you MUST check the "GENERATE DEFAULT PAGE" box or the script will not generate the default page. This feature is here to allow you to test which countries will be redirected to where before you commit.
That's it, you're done.
If you get stuck or need assistance, limited help is available on the forum.