Relative redirect using meta http-equiv="refresh" with gh-pages

15,293

You can use a relative url like ./angular/?layout=4#/app/home.

Your redirect now reads :

<meta http-equiv="refresh" content="0; url=./angular/?layout=4#/app/home" />
Share:
15,293
rex
Author by

rex

Updated on June 17, 2022

Comments

  • rex
    rex almost 2 years

    So i am trying to use the redirect meta tag on a web app hosted on Githubs gh-pages.

    This is the tag I'm using; which works well on the local dev machine

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

    The problem is that gh-pages sites live on a URL like this

    https://github.com/username/reponame
    

    Which means that my redirect doesnt work because it drops the reponame for this:

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

    obviously I could hardcode the repo name in the redirect tag but then this would mean that it wont work when im developing locally because the URL in the local dev doesnt include the repo name.

    How should my meta tag be set up for this to work locally and on gh-pages