是否可以使用 MAMP 创建根域?
目前,我的工作流程是在本地开发,然后作为关键间隔放在远程服务器上。这已经工作了一段时间了,但是自从开始做更多的 AJAX 工作以来,我发现动态地使用根和主机很困难,并且我必须将冗余代码写入我的 JS 以便使同一个文件在本地工作并远程。
有没有一种好方法可以在本地模拟 URL,或者甚至只是使用 MAMP 让每个本地站点都有一个根级域地址(与 localhost/my-dev-site 相对)?
Currently, my workflow is to develop locally, and then place on remote server as key intervals. This has worked fine for a while, but since starting to do more AJAX work, I am finding it difficult to work with roots and hosts dynamically, and am having to write redundant code into my JS in order to make the same file work both locally and remotely.
Is there a good way to mimic a URL locally, or even just have each local site have a root level domain address (as apposed to localhost/my-dev-site) using MAMP?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用主机文件,将其指向 localhost
您提到了 MAMP,所以我假设您使用的是 Mac。
转到 /etc/hosts 并添加此行:
或
Use a host file , point it to localhost
You mentioned MAMP, so I am assuming you are using Mac.
go to /etc/hosts and add this line:
OR