【问题标题】:Relative redirect using meta http-equiv="refresh" with gh-pages使用带有 gh-pages 的 meta http-equiv="refresh" 进行相对重定向
【发布时间】:2016-06-10 15:52:36
【问题描述】:

所以我试图在 Githubs gh-pages 上托管的网络应用程序上使用重定向元标记。

这是我正在使用的标签;在本地开发机器上运行良好

<meta http-equiv="refresh" content="0; url=/angular/?layout=4#/app/home" /> <!--redirect-->

问题是 gh-pages 网站存在于这样的 URL 上

https://github.com/username/reponame

这意味着我的重定向不起作用,因为它为此删除了reponame

https://github.com/username/angular/?layout=4#/app/home

显然我可以在重定向标记中硬编码 repo 名称,但这意味着当我在本地开发时它将无法工作,因为本地开发中的 URL 不包含 repo 名称。

应该如何设置我的元标记以使其在本地和 gh 页面上工作

【问题讨论】:

    标签: html redirect github github-pages


    【解决方案1】:

    您可以使用像./angular/?layout=4#/app/home 这样的相对网址。

    您的重定向现在显示为:

    <meta http-equiv="refresh" content="0; url=./angular/?layout=4#/app/home" />
    

    【讨论】:

      猜你喜欢
      • 2011-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-06
      • 2011-07-20
      • 1970-01-01
      • 2012-06-28
      • 2016-10-02
      相关资源
      最近更新 更多