Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set up 301 redirects from old classic ASP pages to new ASP.NET webforms pages

I've finished developing a website using ASP.NET Webforms and to finish it off I'm in the process of setting up some 301 redirects to ensure the old site's links are redirected properly.

However, the old website was written in classic ASP. What is the best way to set up redirects from old .asp pages to new .aspx pages? (Note: I don't have control over the server the website is being hosted on so I can't do anything in IIS)

like image 687
Leah Avatar asked Jun 08 '12 13:06

Leah


1 Answers

Just place this at the top of your page before any output:

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

Don't put any response.redirects below this code.

like image 70
Chris Avatar answered Sep 30 '22 19:09

Chris