Domain name conversion system implementation. The key technology of domain name redirection system is: implementing webpage redirection (Redirctory ). In essence, domain name redirection systems are completely different from virtual machine systems. The key technology for virtual machine virtual domain names and domain names to turn to the system is: to achieve webpage redirection (Redirctory ). In essence, domain name redirection systems are completely different from virtual machine systems. There is a one-to-one correspondence between virtual domain names and IP addresses of virtual machines. The domain name to the system does not need to map the domain name and IP address one by one. That is to say, it does not need complicated domain name resolution mechanisms or virtual machines. what it does is when you are requesting *. in yourdomain, redirect your browser to the actual address where your Html page is stored.
Next we will implement domain name redirection to the system step by step:
(Assume that your domain name is www.mydomain.com and the host address is 196.0.0.1 ).
First, set DNS to direct * .mydomain.com to our host address 196.0.0.1. (If you do not have your own DNS server, you can skip this step and contact your domain name service provider to ask them to help you direct * .mydomain.com to 196.0.0.1)
The DNS management tool of win2000 does not allow you to directly enter the host name as *, that is, we cannot directly Direct * .mydomain.com to the same IP address in win2000DNS management tool. However, we can change the winntsystem32dnsmydomain. dns file. This file is saved in text format and can be opened on the WordPad.
We need to add A record * A 196.0.0.1 at the end.
We update server data files in WIN2000 DNS management tools. You will find that the mydomain.com domain contains the host "*" that we could not directly add. (Note: Your DNS settings will take effect in a few hours .)
To redirect this domain name to the system, we can select php + mysql to run the program on multiple platforms. Please check whether php and mysql are installed on your web server:
We use index.htm to read the HTTP header sent by the browser and send it to dns. php. the dns. php queries the database and returns the redirection address to the client.
Create mysql database mydomain
Create table dns (
Main char (60 ),
Link char (1, 255)
)
Main is used to save * .mydomain.com *
Link is used to save the redirection address corresponding to the domain name.
Create index.htm:
Script
This. location = "dns. php? Url = "+ this. location. href;
Script
Some may ask why php's GetAllHeader () function is not used to obtain the HTTP header information sent by the browser. Because the GetAllHeader () function only supports Apache web servers, we believe that most win2000 users use iis servers. Considering compatibility, we chose to use JavaScript to read the HTTP header information sent by the browser.
Create a dns. php file:
$ Domain = "mydomain.com"; // domain name
$ Database = "mydomain" // database
$ Datauser = "root"; // database user
Partition (Redirctory ). In essence, domain name redirection systems are completely different from virtual machine systems. Virtual domain name and...