Windows下Apache2不同域名解析不同目录实现方法 ,需要的朋友可以参考下
配置环境
系统:win7
PHP版本:5.3.x
MYSQL 版本:5.0.27
Apache:2.2.4 (Win32)
设置方法:
打开D:\wamp\bin\apache\Apache2.2.17\conf\httpd.conf
在最后添加
NameVirtualHost *:80
DocumentRoot "D:\wamp\www\bbs"
ServerName www.a.com
配置中应该注意:
ServerName *:80
这里的*可以改为本机ip比如192.168.1.11
NameVirtualHost *:80 VirtualHost *:80 保持原样不改
再到hosts文件里写一句:127.0.0.1 www.a.com
(Hosts文件的位置: - Windows NT/2000/XP/2003/Vista 默认路径: %SystemRoot%\system32\drivers\etc\)
这样域名 a.com就绑到本机根目录下了,相当于 http://localhost 或
http://127.0.0.1 输入 www.a.com 比较方便啊。
启动apache服务,用以上域名访问
【相关教程推荐】
1. php编程从入门到精通全套视频教程
2. php从入门到精通
3. bootstrap教程

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version
Visual web development tools

Notepad++7.3.1
Easy-to-use and free code editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
