Skip to content

Instantly share code, notes, and snippets.

@carlos-sanchez
Last active December 28, 2015 06:59
Show Gist options
  • Save carlos-sanchez/7461341 to your computer and use it in GitHub Desktop.
Save carlos-sanchez/7461341 to your computer and use it in GitHub Desktop.
// JS Option
window.location = "http://new-website.com";
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();
?>
<!-- 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