1. First open the apache configuration file httpd.conf, and remove the # in front of #Include conf/extra/httpd-vhosts.conf to enable the virtual host function
2. Configure localhost first to avoid problems when accessing localhost later. The root directory of my wamp project is D:wampwww. Add the following information to the end of the configuration file httpd-vhosts.conf under apache's apache/conf/extra;
DocumentRoot "D:/wamp/www"
ServerName localhost AllowOverride None
Order allow , deny
Allow from all
3. Configure virtual hosts for other projects: For example, configure www.zf.com, open the link to directly access the D:/wamp/www/zf/public directory. "DirectoryIndex Index.php" means that accessing the directory to open the "Index.php" file
documentroot "D:/WAMP/WWW/ZF/PUBLIC"
Servername www.zf.com
directoryINDEX INDEX. pHP d "D :/wamp/www/zf/public ">
Options Indexes FollowSymlinks
Allowoverride None
Order Allow, DENY
4, modify C: WindowsSystem32Driver Host file under SETC, open it with a notepad, add 127.0.0.1 www .zf.com , just restart apache.