ASP:
<% Response.Status = "301 Moved Permanently" Response.AddHeader "Location", new_url %>
PHP:
<?php header("HTTP/1.1 301 Moved Permanently"); header("Location: http://abc.com".$_SERVER['REQUEST_URI']); ?>