How to change localhost/site to site.dev

一世执手 提交于 2019-12-04 21:21:01

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

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>

You can point site.dev to 127.0.0.1 in your hosts file and create a binding for the url in the apache config file so that requests from that url point at a specific site/folder in xampp. I've done this in the past for development projects and generally works pretty well.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!