A very simple mechanism for reading old URLs and doing 301 redirects to new URLs, based on a spreadsheet.
<%@ Language = JScript%>
<%
var originalUrl = Request.ServerVariables("HTTP_X_ORIGINAL_URL");
var newUrl = null;
var root = Request.ServerVariables("APPL_PHYSICAL_PATH");
var connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
connStr += String(root);
connStr += ';Extended Properties="text;HDR=Yes;FMT-Delimited";';
var conn = Server.CreateObject("ADODB.Connection");
conn.open(connStr);
var rs = Server.CreateObject("ADODB.recordset");
rs.open("SELECT * FROM links.csv", conn);
while (!rs.EOF) {
if ( String(rs("OLDURL")) == String(originalUrl) ) {
newUrl = String( rs("NEWURL") );
break;
}
rs.moveNext();
}
rs.close();
if (newUrl != null) {
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", newUrl);
}
%>