To make a HTTP redirect in PHP you can use the following snippet.
Sample PHP
<?php header('Location: http://redirectmeto.url'); ?>
To make a HTTP redirect in PHP you can use the following snippet.
<?php header('Location: http://redirectmeto.url'); ?>
To do a HTTP redirect using HTML you can simply use the following meta tag.
<meta http-equiv="refresh" content="0; url=http://codesnippets.fesslersoft.de" />
the 0; is the Time in seconds before the page will be redirected.
Tip
Since there is always a chance that a redirect on a specific device does not work e.g. when javascript is turned off or so, it is in most cases the best way to do a server side redirect using status code 301 Moved Permanently. You shoul’d also place a text with a link to the redirect on the page like “if you are not redirected please follow this link”.
for more informations see Using meta refresh to create an instant client-side redirect, HTTP 301
To do a HTTP redirect using Javascript or jQuery you can use the window.location.href or the window.location.replace property.
window.location.replace("http://codesnippets.fesslersoft.de");
window.location.href = "http://codesnippets.fesslersoft.de";
you should use replace if you want to create a http redirect and href if you want to simulate a click.
You can also do this in jQuery but i personally prefer the methods shown above because there is no need to use jQuery for a http redirect.
var newUrl = "http://codesnippets.fesslersoft.de"; $(location).attr('href',newUrl);
for more information see W3Schools: Location href Property, Location replace() Method