Last active
May 19, 2020 08:19
-
-
Save navhits/1b92fa2d8d2111ee314e2f28c9995b9f to your computer and use it in GitHub Desktop.
Setting up redirects without adding 301 or 302 rules. Primarily useful if you're hosting static content on Github, Firebase or other static resource hosting services.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<script> | |
// Adding a Javascript redirct | |
// The replace() will replace the current document with provided document | |
window.location.replace('//example.com'); | |
</script> | |
<noscript> | |
<!-- | |
No script block is for browsers that do not support or blocks Javascript content | |
Most of the devs use only a meta redirect alone because it is supported across all modern browsers | |
--> | |
<meta http-equiv="refresh" content="0; url=//example.com" /> | |
</noscript> | |
</head> | |
<body> | |
<!-- | |
In case none of the redirect doesn't work for some reason, provide a link to new page | |
This is totally optional | |
--> | |
<h3 style="text-align:center">In case the page does not redirect<a href = "//example.com"> Click Here</a> </h3> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment