Redirecting Package

Killing Redirect to new URL

Copy all of those three files at root in the source domain’s hosting space. Update the target domain name through the example.

  1. Source folder to redirect from, .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^sourcedomain\.com$ [NC]
RewriteRule ^source/path/if/theres$ https://targetdomain.com [R=301,L]
  1. Same folder, index.php file if Apache is running:
<?php
$new_url = "https://targetdomain.com";
header("Location: $new_url");
exit;
?>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="refresh" content="0; URL=<?php echo $new_url ?>">
    <script type="text/javascript">
        window.location.href = "<?php echo $new_url ?>";
    </script>
</head>
<body>
    <p>This page has moved to a new location. If you are not redirected, <a href="<?php echo $new_url ?>">click here</a>.</p>
</body>
</html>
  1. Same folder, index.html:
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="refresh" content="0; URL=https://targetdomain.com">
    <script type="text/javascript">
        window.location.href = "https://targetdomain.com";
    </script>
</head>
<body>
    <p>This page has moved to a new location. If you are not redirected, <a href="https://targetdomain.com">click here</a>.</p>
</body>
</html>