Next Previous Contents

10. Test your web site

Immediately test your web site to make sure it is working. Load up your web browser and surf your own site. Click on anything you can and make sure everything is working just the way you would expect it to work. Are all the pages loading properly? Are all the images appearing?

NOTE: If too many things fail to work during your initial testing, quickly remove or comment out the new lines in your .htaccess file and reupload it to your site. This is how you turn off countrycheck.php. You can safely leave all the files in your "country1" and "country2" directories while you are figuring out what's wrong. All the control is done with the .htaccess file. In most cases, you will probably not see anything wrong if your site is composed of well written code.

Clear your browser's cache so that you aren't being fooled with the browser displaying previously cached pages and images. Go test your web site again. If you are running special things like forums and chat rooms or anything else, go and do some stuff there and make sure it is all working.

If your site is working properly, it's time to find out if the country blocking is working. To test this, we will try to load a special file that doesn't exist. The countrycheck.php program is designed to act just like you are coming from a blocked country if you try to load a file called "countryblocktester.php". So, using a web browser, try this URL (correct it to be your own website):

http://yourwebsite.com/countryblocktester.php

If everything is set up correctly, you should see about a 10 second delay in trying to load this file and then get nothing but a blank page. If you got a page that indicates that a file is not found, then it's not working. Go back and make sure everything is installed correctly.

If the test worked in your main directory, try some other directories. For instance, if you have a directory called "mystuff", try this URL:

http://yourwebsite.com/mystuff/countryblocktester.php

If you get the delay and blank page, it's working. If you have an .htaccess file in the mystuff directory, you might get a file not found error instead, depending on what is contained within that .htaccess file. If this happens and you wish to keep blocked countries out of this directory, add the same code to this .htaccess file as you did to your main .htaccess file.

Repeat the above with each of your directories.

Just keep in mind that you don't have to put an .htaccess file in each directory to be protected. If a directory doesn't have an .htaccess file, the Apache web server will check its parent directory for an .htaccess file. So, basically, if an .htaccess file is in a particular directory, all subdirectories contained within that directory are also protected, unless one of them has an .htaccess file that overrides its parent .htaccess file.


Next Previous Contents