【发布时间】:2011-04-26 06:09:27
【问题描述】:
我在 Windows 7 上使用 XAMPP lite,但我希望将 http://mycustomname 映射到 root/htdocs 中的目录 myfolder 而不是 http://localhost。
我应该在 httpd.conf 中更改什么?
非常感谢!
【问题讨论】:
我在 Windows 7 上使用 XAMPP lite,但我希望将 http://mycustomname 映射到 root/htdocs 中的目录 myfolder 而不是 http://localhost。
我应该在 httpd.conf 中更改什么?
非常感谢!
【问题讨论】:
添加到您的 xampp\apache\conf\extra\httpd-vhosts.conf 文件:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName mycustomname
ServerAlias mycustomname
DocumentRoot "c:\xampp\htdocs\myfolder"
</VirtualHost>
现在编辑 c:\windows\system32\drivers\etc\hosts 并添加一个新行:
127.0.0.1 mycustomname
这将导致 Windows 将您的自定义名称解析为 127.0.0.1。重启 Apache,你就可以访问你的网站了。
【讨论】: