【发布时间】:2019-09-13 05:32:03
【问题描述】:
我想将我的 API 应用程序托管在单独的服务器中,并通过子域路由它,例如 api.example.com。我的域托管在 HostGator。我创建了一个子域并通过提供 IP 地址将其重定向到 API 服务器。
应用程序是用 Codeigniter for RestAPI 编写的。每当我通过引用子域调用任何 API 方法时,它都会显示 404 错误 (api.example.com/myclass/myfunction),但是如果我通过提供服务器的 IP 地址使用直接链接 (192.0.2.1/myclass/myfunction) 访问相同的 API,它会返回正确的结果.
请提出任何需要的配置更改。
【问题讨论】:
-
redirect it to the api server by providing the IP address- 你是怎么做到的?一些.htaccess规则?你的代码在哪里?你的路线是什么样的?当我们看不到您在做什么时,我们很难提供帮助。
标签: api codeigniter subdomain