php开启虚拟域名功能

1.开启apache的mod_rewrite功能

关闭注释

LoadModule rewrite_module modules/mod_rewrite.so

2.引入http-vhosts.conf文件

关闭注释

Include conf/extra/httpd-vhosts.conf

3.添加VIrtualHost配置

修改 conf/extra/httpd-vhosts.conf

 

NameVirtualHost *:80

<VirtualHost *:80>

     ServerAdmin [email protected]

     DocumentRoot "D:/wamp/www/test/2"

     ServerName haha.com

</VirtualHost>

<Directory "D:/wamp/www/test/2">

     AllowOverride None

     Options None

     Order allow,deny

     Allow from all

</Directory>

4.修改host文件

添加 127.0.0.1 hah.com

你可能感兴趣的:(PHP)