For anyone who needs it for ASP.NET websites.
<script runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Response.Status = "301 Moved Permanently"
Response.AddHeader("Location", "http://www.yourwebsite.com/newlocation.aspx")
End Sub
</script>