Redirection in PHP can be done using the header() function.
To setup a simple redirect, create an index.php file in the directory you wish to redirect from with the following content:
<?php
header("Location: http://www.redirecturl.com/");
exit();
?>
Where 'http://www.redirecturl.com/' is the URL you wish the users to be redirected.
If this is a 301 Permanent redirect, you can use:
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.redirecturl.com/");
exit();
?>
Here is another more dynamic example:
<?php
$link = "link.php";
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://".$_SERVER["HTTP_HOST"].$link);
exit();
?>
--------------------------------
The following example will force an https redirect with PHP to the same page:
<?php
if (!isset($_SERVER["HTTPS"]) {
header("Location: https://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
exit();
}
?>