我曾经使用以下书签代码在我的站点的登台服务器和实时服务器之间交换 URL,因此我可以测试登台页面是否已成功推送到现场:
登台网址:www.stage.site.com/folder/page.html
实时网址:www.site.com/folder/page.html
这是该书签的代码;剧本有两个方向:舞台生活和舞台生活:
javascript:if(location.host=='www.site.com')(location.href='http://www.stage.site.com'+location.pathname);if(location.host=='www.stage.site.com')(location.href='http://www.site.com'+location.pathname);
但是,我的网站架构发生了变化(CMS),并且暂存 URL 现在与实时 URL 完全不同:
创作网址:author.site.com/bucket1/bucket2/bucket3/folder/page.html
实时网址:www.site.com/folder/page.html
我无法弄清楚如何重写该小书签代码,以便它可以处理截断的路径名。