When doing PHP local debugging, generally have to hit the localhost/, if your project hierarchy is more, then your URL address will be very long.
Can we use a short domain name instead of a long list of useless characters?
Then someone might ask, what if I don't have a domain name? In fact, in the development phase, we can build a virtual domain name locally, the following steps:
(1) Open Apache httpd-vhosts.conf (Wampserver For example, directory under D:\wamp\bin\apache\apache2.4.23\conf\extra)
(2) Enter below the file
<virtualhost *:80>//80 for Apache port number DocumentRoot "e:/study/demo/project1/"//quotation mark fill in the project address ServerName zyf.cn Fill in your virtual domain </VirtualHost>
This step will allow Apache to recognize our virtual domain name, below we will also let our browser to know our virtual domain name
(3) Open c:\Windows\system32\drivers\etc The following Hosts file (Notepad open), enter 127.0.0.1 zyf.cn at the bottom of the file
Done!
Apache Configure virtual domain name