Permanent 301 Redirect in PHP and classical ASP

PHP

If we need to redirect any static page to a new Website URL,
you can use the following code, inside the index.php file of your site.

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.newdomain.com/page.html");
exit();
?>

ASP
Following server script will be helpful, when redirection is needed.

<%
Response.Status="301 Moved Permanently"
Response.AddHeader='Location','http://www.new-url.com/'
%>

Advertisements