是否可以在我自己的域下托管 PHP Web 应用程序,但将 url 重写为另一个域名?
我目前正在用 PHP 构建一个简单的 Web 应用程序,其他公司可以将其用作他们的服务之一。我想自己托管该应用程序,而不是将其安装在他们的一台服务器上,但我确实想要它提供的可访问性。 示例:
www.mywebapp.com 是我托管 Web 应用程序的位置。
www.company.com 将是客户的域名。
webapp.company.com 应重定向到 www.mywebapp.com/?c=company。导航后,webapp.company.com/view.php?v=test 也会重定向到 www.mywebapp.com/view.php?c=company&v=test
有人可以解释我如何实现这一目标,以及考虑到我的要求这是否是最佳选择?
I'm currently building a simple web application in PHP that other company's can use as one of their services. I want to host the application myself and not install it on one of their servers, but i do want the accessibility that that would offer. Example:
www.mywebapp.com is where i would host the web application.
www.company.com would be the domain name of the client.
webapp.company.com should redirect to www.mywebapp.com/?c=company. Upon navigation, webapp.company.com/view.php?v=test would also be redirected to www.mywebapp.com/view.php?c=company&v=test and so on upon further using the web app.
Can someone explain how i can achieve this and if this is the best option considering my requirements?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议您转而实施 API。许多公司就是这样解决这个问题的。他们只是有一个 API 密钥,可以让你的服务器知道他们是什么客户端,从而知道为他们提供什么服务。
API 资源:
我认为你的想法是可能的,如果两台服务器都是设置正确,但是你不觉得不对吗?
I recommend that you switch to implementing an API. That's how this problem is solved by many corporations. They simply have an API key that will let your server know what client they are and therefore what to serve them.
Resources on API's:
I think your idea IS possible if both servers are set up correctly, but doesn't it feel wrong to you?
您需要有一个指向同一服务器的两个域的“a”记录
http://corz.org/serv/tricks/htaccess2.php?page=all#section-rewrite_sub-domains
You would need to have an 'a' record for both domains pointing to the same server
http://corz.org/serv/tricks/htaccess2.php?page=all#section-rewrite_sub-domains