是否可以使用 MAMP 创建根域?

发布于 2024-09-25 02:31:18 字数 212 浏览 1 评论 0原文

目前,我的工作流程是在本地开发,然后作为关键间隔放在远程服务器上。这已经工作了一段时间了,但是自从开始做更多的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你另情深 2024-10-02 02:31:18

使用主机文件,将其指向 localhost

您提到了 MAMP,所以我假设您使用的是 Mac。

转到 /etc/hosts 并添加此行:

127.0.0.1   www.whateveryoururl.com

127.0.0.1   www.whateveryoururl.com whateveryoururl.com

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:

127.0.0.1   www.whateveryoururl.com

OR

127.0.0.1   www.whateveryoururl.com whateveryoururl.com
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文