When building a website, we often need to point the registered domain name to the local code, for code debugging needs, but the local server configuration default address is localhost or 127.0.0.1, how to point the local domain name to the local server? Take Window7+apache server as an example, see the picture below.
1 First locate the host file under widow based on the prompt of the picture,
2 Open File Add domain name and corresponding IP address, red line hint at
3 Locate the httpd-vhosts.conf file in the directory that corresponds to the Apache installation location,
4 Open the file, add the code shown in the Red box, DocumentRoot to the file address, servername as the domain name,
5 based on the DocumentRoot address of the previous step, locate the path, create the directory, and create the home page file in the directory. Then open the browser input URL can be accessed.
How to point a domain name to a local server