网页重定向

发布于 2024-11-03 12:31:34 字数 195 浏览 8 评论 0原文

我试图实现以下目标:

当用户在浏览器的地址栏中键入“print”(或“http://print”)时:

我希望将用户重定向到页面:www.abc .com/print/

如何实现这一目标?我尝试查找一些鱿鱼配置,但找不到相同的配置。

谢谢!

编辑:我不明白如何处理反对票,这是一个完全有效的问题。

I am trying to achieve the following:

when a user types "print" (or "http://print") in the address-bar of the browser :

I want the user to be re-directed to a page : www.abc.com/print/

How can one achieve this ? I tried to lookup some squid configurations but was unable to find the same.

Thanks!

Edit : I do not understand the deal with down votes, this is a perfectly valid question.

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

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

发布评论

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

评论(1

╰つ倒转 2024-11-10 12:31:34

如果您希望 LAN 上的用户能够在地址栏中键入“print”并重定向到给定的主机名,则必须为此提供 DNS 记录。这不是在 Web 服务器上完成的,也不是在任何方面的 Web 开发。

有多种方法可以将给定主机名解析为给定 IP 或另一个主机名。一种方法是编辑客户端主机文件,如另一个答案中所述。如果您的 LAN 环境中运行着 DNS 服务器,还可以添加 A 记录来实现这一效果。

您必须了解如何通过浏览器查找主机名。当您在地址栏中键入内容时,浏览器会使用操作系统将主机名解析为 IP 地址。您的操作系统使用其主机文件、互联网连接和其他机制来完成此操作。这个过程本身有几个层和步骤,这些层和步骤超出了浏览器的范围,并且不受浏览器的影响。在此过程中也不会咨询任意网络服务器。您的目标是在此过程中注入一些内容,将主机名“print”解析到您选择的网络服务器 - 然后网络开发可能会发挥作用。

请参阅:http://www.quackit.com/how-websites -work/how-dns-works.cfm

If you want to enable a user on your LAN to type "print" in the address bar and be redirected to a given hostname, you'll have to supply a DNS record to that effect. This is not accomplished on a web server, nor is it web development in any respect.

There are several methods to resolving a given hostname to a given IP or to another hostname. One way is to edit the client hosts file, as described in another answer. One could also, if you have a DNS server running within your LAN environment, add A records to this effect.

You must understand how hostname lookups work from a browser. When you type something in the address bar, your browser uses your operating system to resolve the hostname to an IP address. Your operating system uses its hosts file, internet connection, and other mechanisms to accomplish this. This process itself has several tiers and steps that are outside the scope of the browser and which cannot be influenced by the browser. Nor will arbitrary web servers be consulted in this process. Your aim is to inject something in this process that resolves the hostname "print" to the webserver of your choosing - THEN web development might come in to play.

See: http://www.quackit.com/how-websites-work/how-dns-works.cfm

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