<% dim pageRequested, pageErrorNum, missingURL, newURL, DebugMode, BaseURL, defaultURL, redirectURL dim URLarray 'as array BaseURL="www.affinia.com" defaultURL="/" debugMode=false 'Have we been here before with the same file name/URL? 'refering URL should tell us and if it is the same as the one we have, let's send to home page. with request if isempty(.queryString) or .queryString="" then pageRequested = "http://" & BaseURL & "/!404" 'someone trying to access this script directly pageErrorNum = "" else pageRequested = mid(.queryString, instr(.queryString,";") + 1) pageErrorNum = left(mid(.queryString, instr(.queryString,";") - 3),3) end if end with 'bulid array based on the /'s URLarray=split(pageRequested, "/") 'missingURL=URLarray(ubound(URLarray)) CleanString = URLarray(0) & "/" & URLarray(1) & "/" & URLarray(2) & "/" 'response.write "
" & CleanString & "
" 'remove the http://somedomain/ missingURL=replace(pageRequested,CleanString,"") 'strip off any URL variables. if there is a ? strip off it and everything after 'cleans off page_name.cfm?thisURL=sampleval... URLarray=split(missingURL, "?") missingURL=URLarray(0) newURL=GetNewURL(missingURL) if newURL="!404" then newURL=defaultURL 'CHeck for existence of file!!!! If FileExist(server.MapPath(newURL)) Then redirectURL = BaseURL & newURL else redirectURL = BaseURL & defaultURL if DebugMode then response.write "a00_404" 'response.write "" response.write "" response.write "
OLD NEW
" & missingURL & "" & newURL & "
" response.Write "Db record:
http://" & BaseURL & newURL& "

NOTE: if the redirect below is different than the path above, the file path recorded in the Db for this URL does NOT exist on the server. Please check server path in Db and make sure you have the file on the server in said path...

" response.write "

301 Moved Permanently
" response.write "Location, http://" & redirectURL & "


" 'If FileExist(server.MapPath(newURL)) Then 'response.write"FOUND!:|" & newURL & "|" 'else 'response.write"NOT FOUND!:|" & newURL & "|
" 'response.write"REDIRECT TO defaultURL: http://" & redirectURL 'end if Else Response.Status = "301 Moved Permanently" Response.addheader "Location", "http://" & redirectURL Response.End End If %> Affinia | Object Permanently Moved

Object Permanently Moved

This page has permanently moved.
You are being redirect to http://www.affinia.com.