一、配置本地路由表(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配置