Last active
December 28, 2015 06:59
-
-
Save carlos-sanchez/7461341 to your computer and use it in GitHub Desktop.
Redirect.
http://css-tricks.com/redirect-web-page/
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
// JS Option | |
window.location = "http://new-website.com"; |
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
Esto es lo único que debe aparecer en index.php. No incluir etiquetas <html>. | |
<?php | |
header('Location: http://www.new-website.com'); | |
exit; | |
?> | |
// This has to be set before any markup or content of any other sort, however there is one small hitch. By default the function sends a 302 redirect response which tells everyone that the content has only been moved temporarily. Considering our specific use case we'll need to permanently move the files over to our new website, so we'll have to make a 301 redirect instead: | |
<?php | |
header('Location: http://www.new-website.com/', true, 301); | |
exit(); | |
?> |
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
<!-- Option 1 --> | |
<body onload="javascript:window.location.href='http://www.chocolatinagrafica.com'"> | |
<!-- Option 2 --> | |
<!-- Although this method is the easiest way to redirect to a web page there are a few disadvantages. According to the W3C there are some browsers that freak out with the Meta refresh tag. Users might see a flash as page A is loaded before being redirected to page B. It also disables the back button on older browsers. It's not an ideal solution, and it's discouraged to use at all. --> | |
<meta http-equiv="refresh" content="0; URL='http://new-website.com'" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment