如何将 localhost/site 更改为 site.dev [英] How to change localhost/site to site.dev

查看:35
本文介绍了如何将 localhost/site 更改为 site.dev的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 XAMPP 进行本地开发,我听说开发人员将 url 结构从 localhost/site 更改为 site.dev,但我不确定如何去做.

I use XAMPP for local development and I've heard of developers that change the url structure from localhost/site to site.dev, but I'm not sure how to go about it.

我该如何更改它,在更改它之前有什么我应该知道的吗?

How can I change it and is there anything I should know before changing it?

推荐答案

您需要在主机文件中添加一个条目以将 site.dev 映射到 localhost

You'll need to add an entry in your host file to map site.dev to localhost

127.0.0.1 site.dev www.site.dev

并在apache中添加一个虚拟主机进行检测

and add a virtual host in apache to detect it

<VirtualHost *:80>
    DocumentRoot /path/to/document/root/site/
    ServerName site.dev
    ServerAlias  www.site.dev
# Other directives here
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /path/to/document/root/
    ServerName localhost
# Other directives here
</VirtualHost>

这篇关于如何将 localhost/site 更改为 site.dev的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆