同步跨域页面地址

Synchronize cross-domain page address

我有两个 link:

http://something.something.com/ (an local institute server...)
http://xxx.xxx.xxx.xxx/ (an amazon cloud C2)

我希望我的用户和几乎每个人都可以访问 http://something.something.com/,但是这个 link 不是我想要配置的,我只有 FTP 访问权限并且我希望它静静地将访问者重定向到 http://xxx.xxx.xxx.xxx/.

我已经研究和测试过,使用 iframe,我没有得到 link 翻译,例如,我没有得到例如 http://something.something.com/something/ 默默地翻译成 http://xxx.xxx.xxx.xxx/something/ ,在 iframe 上,它在本地服务器 insted 中搜索 something,但它不存在。并且导航 iframe 没有反映在本地主机地址

到目前为止我读到的内容导致了一些想法,比如使用 postMessage.htaccess,但我对什么是最好的(甚至有效的)解决方案感到困惑,因为我我什至不确定我会在 google 上搜索什么,非常感谢您的指导。

更新.1:

我对 FTP 的访问权限有限,它是一个共享域,所以我有一个 home/www/mydir 目录,我无权访问服务器 ROOT 目录或系统和服务配置。

在本地网络上,您可以通过将 ip 注册到每个本地 pc 上的 /etc/hosts 来创建别名。

xxx.xxx.xxx.xxx   someting.something.com

这比较棘手,但我已经解决了。更糟糕的是,我的 local 地址不允许使用 .htaccess 代理规则,所以我依赖 iframepostMessage 以及 .htaccess.

在因缺少代理方式而苦苦挣扎之后,我配置了 .htaccess 因此任何 link 都会产生相同的地址,我的 index.html 文件:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/index.html$
RewriteRule .* /index.html [L]

local server,一个用户访问,我这样做了:

    <iframe id="subD" width="100%" height="100%" src="http://x.x.x.x">
        Sorry your browser did not support iframes.
    </iframe>

    <script>
        // load url on iframe  
        var sub = window.location.pathname;
        document.getElementById("subD").
            contentWindow.document.
            location.href="http://x.x.x.x" + window.location.pathname;

        //get url from amazon server
        window.addEventListener("message", updateUrl, false);
        function updateUrl (event) {
            var origin = event.origin || event.originalEvent.origin;
            if (origin !== "http://x.x.x.x")
                return;
            current = window.location.pathname

            //take care of maintaining a back history whille navigating
            window.history.pushState({"link":current},"",event.data);
        }

        // on back/next event load history on frame
        window.onpopstate = function(e){
            if(e.state == e.state.link){
                var rand = Math.floor((Math.random()*1000000)+1);
                var iframe = document.getElementById('subD');
                iframe.src = "http://x.x.x.x" + e.state.link + "?uid=" + rand;
            } else {
                history.back();
            }
        };
    </script>

amazon server 我发送消息更新 local server:

  <script>
      parent.postMessage(window.location.pathname,"http://something.something")
  </script>