PHP Classes

File: readme.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Nadir Latif  >  Change Web Site Mode  >  readme.txt  >  Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: Help file
Class: Change Web Site Mode
Switch access to sites between test and production
Author: By
Last change: Initial commit
Date: 10 months ago
Size: 2,339 bytes


Class file image Download
Made by: Nadir Latif (

1) Overview:

-Allows web masters to work with multiple websites (any number) in test mode. Each web site must have copy on the live server and on a test server. The script allows user to switch between the two copies of the website without having to change the url.
-Provides a GUI interface for switching websites from test mode to live mode. The copy of the websites to be tested may be on localhost or on another machine. The script basically edits two files. The host file on localhost (from where the website is viewed) and the htaccess file on an apache server that hosts the copies of multiple websites to be tested.

2) Requirements

-Requires php 4.
-Apache web server on the computer which contains the copies of the websites.
-All web sites must be copied to the root folder of the apache web server.
-Each web site must be in a folder called public_html, which in turn must be in a folder of the same name as the web site. e.g
-Place a .htaccess file in apache's root folder.
-The web page produced by the script uses vbscript so the script must be viewed using internet explorer with activeX support for untrusted scripts enabled.

3) How it works:

-To bring a site to test mode, the script adds a line in host file using vbscript which causes the site webpage to be fetched from the test server instead of the actual webserver. An entry is also made in the local apache htaccess file which causes the page to be fetched from the web sites folder. If the website is in test mode the url will fetch the page from the test server, while if it is in live mode the page will be fetched from the actual server. All this will be invisible to the user.
-Only one website can be in test mode at a time.

4) Usage:

-Replace the string "E:\www\\" with the location of the web root of the test server.
-Replace the string "E:\www\.htaccess" with the location of a htaccess file on the web server that will host the multiple test websites.
-Replace the string "C:\WINDOWS\system32\drivers\etc\hosts" with the location of the host file on locahost.
-Place this script on the directory of a web server and access it using internet explorer with activeX support for untrusted scripts enabled.
-Feel free to contact me for any assistance regarding this script.