从域名重定向到点线四元托管盒

发布于 2024-07-04 10:06:53 字数 264 浏览 4 评论 0原文

我有一个运行我的域名的 php 服务器。 出于测试目的,我在虚线四 IP 上运行 asp.net。 我希望通过 PHP 或某种 DNS/.htaccess voodoo 将它们链接在一起。

因此,如果我转到 www.mydomain.com/test ,它会重定向(但将 (www.mydomain.com/test) 的 url 保留在浏览器的地址栏中,并且页面由点线四 IP asp.net 框提供服务。

I have a php server that is running my domain name. For testing purposes I am running an asp.net on a dotted quad IP. I am hoping to link them together via either PHP or some kind of DNS/.htaccess voodoo.

So if I go to www.mydomain.com/test it redirects (but keeps the url of (www.mydomain.com/test) in the browser's address bar and the pages are served by the dotted quad IP asp.net box.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(5

只为守护你 2024-07-11 10:06:53

最简单的方法是让 www.mydomain.com/test 提供一个 HTML 文件,该文件具有带有纯 IP 地址的单个框架。 然而,这意味着(很棒的)地址栏中的 URL 始终保持完全相同,即使您单击显示页面上的链接也是如此。 (您可以通过在 href 中添加 target=_top 来避免这种情况,但这需要对您的“asp.net”进行一些修改。)

我能想到的唯一其他方法of 是让 www.mydomain.com 充当代理。 也就是说,在 /test 它有一个脚本或其他东西,可以从“asp.net”获取页面并将其转发到客户端。

The easiest way is to make www.mydomain.com/test serve a HTML file which has a single frame with the plain IP address. However, this means that the URL in the (awesome) address bar always stays exactly the same, even if you click a link on the displayed page. (You can avoid this by adding target=_top in the href, but this would require some modifications to your "asp.net".)

The only other way I can think of is to make www.mydomain.com act as proxy. That is, at /test it has a script or something that gets the page from your "asp.net" and forwards it to the client.

忘羡 2024-07-11 10:06:53

如果我明白你的意思的话,这是很有可能的。

您有一个 PHP 服务器,您的域名指向它。 您还有一个单独的 ASP.NET 服务器,它只有一个与之关联的 IP 地址,没有域。

简单地将域名指向 ASP.NEt 框有什么缺点吗?

It is quite possible, if I understand what you're getting at.

You have a PHP server with your domain pointing to it. You also have a separate ASP.NET server that only has an IP address associated with it, no domain.

Is there any drawback to simply pointing your domain name to your ASP.NEt box?

妖妓 2024-07-11 10:06:53

为什么不使用 test.yourdomain.com 而不是将 www.yourdomain.com/test 指向您的测试服务器呢?

假设您有权访问 yourdomain.com 的 DNS 记录,您只需创建一条 A 记录,将 test.yourdomain.com 映射到测试服务器的 IP 地址。

Instead of pointing www.yourdomain.com/test at your test server, why not use test.yourdomain.com?

Assuming you have access to the DNS records for yourdomain.com, you should just need to create an A record mapping test.yourdomain.com to your test server's IP address.

原谅我要高飞 2024-07-11 10:06:53

我同意子域的想法是最好的,但如果由于某种原因它不适合你,你也可以在 /test 代理请求点分四机上的 URL 上的 php 页面(使用 fopen 访问点四边形 URL)。

I agree that the sub-domain idea is the best, but if for some reason it doesn't work for you you could also have the php page at /test proxy requests to a URL at the dotted quad machine (using fopen to access the dotted quad URL).

人│生佛魔见 2024-07-11 10:06:53

您可以使用代理来完成此操作,但我认为威尔·哈里斯的答案是最好的 - 使用子域。 更简单,它也将消除相关链接的问题。

You can do this with a proxy, but I think Will Harris's answer is the best - use a subdomain. Much simpler, and it'll get rid of issues with relative links as well.

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