一、配置本地路由表(C:\Windows\System32\drivers\etc\hosts)apache
在文件的末尾加入 ide
127.0.0.1 localhostui
127.0.0.1 www.tp5.com code
二、apache开启虚拟主机(D:\xampp\apache\conf\httpd.conf)路由
# Virtual hosts Include conf/extra/httpd-vhosts.conf//确保此段开头没有#,也就是确保引入了 vhosts 虚拟主机配置文件。 <Directory "D:/xampp/cgi-bin"> AllowOverride All Options None Require all granted </Directory> //修改成 <Directory "D:/xampp/cgi-bin"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> DocumentRoot "D:/xampp/htdocs"//确保此处路径是你要访问的项目的根路径
三、修改虚拟主机配置(D:\xampp\apache\conf\extra\httpd-vhosts.conf)io
<VirtualHost *:80> DocumentRoot "D:/xampp/htdocs/" ServerName localhost </VirtualHost> <VirtualHost *:80> DocumentRoot "D:/xampp/htdocs/tp5/public" ServerName www.tp5.com </VirtualHost>
四、重启apache配置