是否可以设置某种自定义主 DNS 来重新路由 URL?
基本上,我现在在家用 PC 上运行的是 WAMP 盒装应用程序之一,这样我就可以编写 PHP 代码并使用 MySQL 数据库。 这一切都很好,但我运行了很多网站,所以现在我有一个名为 /~WEBSITES/ 的文件夹,我将所有内容放入这些 http://localhost/~WEBSITES/domain.com/ -- 我想要的是能够输入 http://local.domain.com/ 进入我的地址栏并让它指向我的本地驱动器,但我不希望每个人都这样, 只有我。
可能的?
注意:我运行的是 Windows XP
Basically what I run now on my home PC is one of these WAMP in a box applications so I can write my PHP code and use a MySQL database. That is all fine, but I run a lot of websites so now I have a folder I've called /~WEBSITES/ where I put everything making the URLs to these http://localhost/~WEBSITES/domain.com/ -- what I'd like is to be able to type http://local.domain.com/ into my address bar and have it point to my local drive, but I don't want this for everyone, just me.
Possible?
NOTE: I've running Windows XP
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要设置 使用 Apache 的虚拟主机,并将其与 HardCode 的答案结合起来(设置您的主机文件)。 那应该可以满足您的需要。
作者编辑:很棒的文章,这里是关于做什么的快速说明(至少使用最新版本的 apache2triad 作为您的 WAMP 安装程序)
添加到 C:\APACHE_INSTALL_DIRECTORY\conf\httpd.conf
:到 C:\Windows\system32\drivers\etc\hosts
You'll need to setup virtual hosts with Apache, and combine that with HardCode's answer (setting your hosts file). That should do what you need.
AUTHOR EDIT: Great article, here's the quick notes on what to do (at least with the most recent version of apache2triad as your WAMP installer)
Add to C:\APACHE_INSTALL_DIRECTORY\conf\httpd.conf:
Add to C:\Windows\system32\drivers\etc\hosts
修改 C:\Windows\system32\drivers\etc\ 中名为“hosts”的文本文件
假设您要将 www.mycustomer.com 指向本地主机。 添加地址:
127.0.0.1 www.mycustomer.com
Modify the text file named "hosts" found in C:\Windows\system32\drivers\etc\
Suppose you want to point www.mycustomer.com to your local host. Add in:
127.0.0.1 www.mycustomer.com
您需要 在 apache 中设置虚拟主机(不是 IIS...哎呀),并将其与 HardCode 的答案结合起来。 那应该可以满足您的需要。
You'll need to setup virtual hosts in apache (not IIS... oops), and combine that with HardCode's answer. That should do what you need.