浏览器网址栏中的网址由于网页转发而快速变化 [英] URL in browser's URL bar changes quickly because of web forwarding

查看:278
本文介绍了浏览器网址栏中的网址由于网页转发而快速变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个VPS,IP 123.123.123.123 ,Apache在7010端口上侦听(我自己只有端口7000 ... 7020) p>

我已经通过域名提供商注册了一个域 mydomain1.com ,他们提供了一个web转发:

 名称TTL类型优先内容转发到
* .mydomain1.com 3600 A 0 212.20.xx xx http://123.123。 123.123:7010 /

它的工作原理!现在,当我在浏览器网址栏中写入 http://www.mydomain1.com 时,它会自动转到< a href =http://123.123.123.123:7010/ =nofollow noreferrer> http://123.123.123.123:7010/ 。



问题:浏览器网址栏仅显示 http://www.mydomain1.com 0.5秒,然后显示 http://123.123 .123.123:7010 / ,这在用户体验方面不太好。



如何保持显示 http://www.mydomain1.com 在浏览器网址栏中



我应该使用Javascript进行抄袭 history.pushState(...)



我应该怎么做这在 .htaccess 中有一些 ReverseProxySomething



另一个方法?

解决方案

域名提供者从默认转发到框架只需解决问题。

< img src =https://i.stack.imgur.com/eeHdk.jpgalt =enter image description here>



唯一的缺点是这是由此产生的HTML,所以这意味着它是某种黑客...

 <!DOCTYPE html PUBLIC  -  // W3C // DTD XHTML 1.0 Frameset // ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\"> 
< html xmlns =http://www.w3.org/1999/xhtml>
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = utf-8/>
< / head>
< frameset frameborder =noborder =0framespacing =0>
< frame src =http://123.123.123.123:7010/name =mainFrameid =mainFrametitle =mainFrame/>
< / frameset>
< noframes>
< body>
< a href =http://123.123.123.123:7010/>点击重定向< / a>
< / body>
< / noframes>
< / html>

仍然寻找更好/更清洁的解决方案!


I have a VPS with the IP 123.123.123.123 and Apache listens there on port 7010. (I only have ports 7000 ... 7020 for myself).

I have registered a domain mydomain1.com by a domain provider and they offer a "web forwarding" :

Name                TTL     Type    Priority    Content        Forwards to
*.mydomain1.com     3600    A       0           212.20.xx xx   http://123.123.123.123:7010/

It works! Now when I write http://www.mydomain1.com in the browser URL bar, it automatically goes to http://123.123.123.123:7010/.

Problem: the browser URL bar only displays http://www.mydomain1.com for 0.5 seconds, and then displays http://123.123.123.123:7010/ instead, which is not nice in terms of user experience.

How to keep the display http://www.mydomain1.com in the browser URL bar?

Should I hack this with Javascript history.pushState(...)?

Should I do this in .htaccess with some ReverseProxySomething?

Another method?

解决方案

Going from "Default Forwarding" to "Framed" by the domain provider simply solved the problem.

The only drawback is that this is the resulting HTML, so this means it's some sort of hack...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<frameset frameborder="no" border="0" framespacing="0">
    <frame src="http://123.123.123.123:7010/" name="mainFrame" id="mainFrame" title="mainFrame" />
</frameset>
<noframes>
    <body>
        <a href="http://123.123.123.123:7010/">Click to be redirected</a>
    </body>
</noframes>
</html>

Still looking for a better / cleaner solution!

这篇关于浏览器网址栏中的网址由于网页转发而快速变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆