如何将git用于具有子域环境的Web应用程序
我运行了一个自定义的Web应用程序,并且一直在努力将其转移到Git上,但是由于Web应用程序的子域环境,我遇到了文件路径问题。
Web应用程序由以下网站组成:
- root-Level域(app.com)
- 管理区域的公共网站“我的” subdomain(my.app.com)
- 基本的仅读取API,at“ api” subdomain(api.app.com) )
每个领域都有自己的模板和路由脚本集,但共享一组共同的类和顶级配置文件。
当我在MAMP中加载Web应用程序的本地副本时,大多数公共网站环境都可以使用,但是在尝试将文件包含在项目中时,未找到的子域环境(“我的”和“ API”)throw“找不到”错误。
这是因为子域环境认为它们是自己的“根级”位置。在本地计算机上的git上,“ my.app.com”转换为“ app_folder/my”(子文件夹)。和一个URL之类的URL之类的URL转换为“ app_folder/my/users/< user_id>”。这为Web应用程序的子域位置提供了文件路径。
是否有某种方法可以在本地计算机上设置等效的DNS设置以使子域在GIT项目中起作用?
也许我需要学习另一种设置方法?
如果有帮助,Web应用程序是用PHP编写的。
我感谢您的见识。
I run a custom web app, and I've been working towards transitioning it onto Git, but I am running into a file path problem because of the web app's subdomain environments.
The web app is comprised of:
- public website at the root-level domain (app.com)
- admin area at "my" subdomain (my.app.com)
- basic read-only API at "api" subdomain (api.app.com)
Each of those areas have their own sets of templates and routing scripts, but share a common set of classes and top-level configuration files.
When I load up a local copy of the web app in MAMP, most of the public website environment works, but the subdomain environments ("my" and "api") throw "file not found" errors when attempting to include files in the project.
This is because the subdomain environments assume they are their own "root-level" locations. On Git on a local machine, "my.app.com" translates to "app_folder/my" (a subfolder). And a URL like "my.app.com/users/<user_id>" translates to "app_folder/my/users/<user_id>". This is throwing off file paths for the subdomain locations of the web app.
Is there some way to set up equivalent DNS settings on a local machine to make subdomains work on a Git project?
Or maybe there is another setup method I need to learn about?
If it helps to know, the web app is written in PHP.
I'd be grateful for your insight.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论