1、wamp 配置虚拟域名,自定义域名php
一、d:\wamp\bin\apache\Apache2.2.17\conf\httpd.conf
(1)#Include conf/extra/httpd-vhosts.conf 去掉注释
(2)找到这段
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
改成
<Directory />
Options FollowSymLinks Includes
AllowOverride None
Order deny,allow
Allow from all
</Directory>apache
二、d:\wamp\bin\apache\Apache2.2.17\conf\extra\httpd-vhosts.conf浏览器
<VirtualHost *:80>
DocumentRoot "d:\wamp\www\文件夹"
ServerName 域名1(不用http)
ServerAlias 域名2 (不用http)
</VirtualHost>ide
三、C:\WINDOWS\system32\drivers\etc\hosts
底部添加记录: 127.0.0.1 你要设置的域名2(不用http)域名
只要文件夹下有文件,就能够经过设置的域名在浏览器访问。io
2、wamp 127.0.0.1正常打开,localhost空白403/404配置
(1) d:\wamp\bin\apache\Apache2.2.17\conf\extra\httpd-vhosts.conf添加记录
<VirtualHost *:80>
DocumentRoot "d:\wamp\www"
ServerName localhost
</VirtualHost>wamp
(2)d:\wamp\bin\apache\Apache2.2.17\conf\httpd.conf
找到
Deny from all
Allow from 127.0.0.1
改成
#Deny from all
#Allow from 127.0.0.1
Allow from allhosts
若还有问题,就查看一下 C:\WINDOWS\system32\drivers\etc\hosts 里面是否有该记录,没有本身添加: 127.0.0.1 localhost注释
同理,若想localhost\phpmyadmin正常访问:D:\wamp\alias\phpmyadmin.conf 找到Deny from allAllow from 127.0.0.1改成#Deny from all#Allow from 127.0.0.1Allow from all