Question

I recently converted a site from asp to CF. Unfortunately, alot of the old users had the "homepage" bookmarked. www.example.com/homepage.asp

Is there a sort of catch all way I could redirect any traffic from that page to the current index.cfm?

I would normally just delete those files, but the owner(s) wanted to keep it around for their own comparison reasons.

Any ideas?

Thanks

Was it helpful?

Solution

Put this in the old homepage.asp

<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "/index.cfm"
%>

OTHER TIPS

If you don't want run an onerous asp file at all on the new site, you can do a custom 404 on the web server. If you point the 404 page to a .cfm file, you can extract all the various features from the request by including:

<!--- parse out the text in the URL parameters into an array --->
<cfset variables.requestparams = listtoarray(cgi.query_string,'/?&')>

<!--- get rid of the first 2 items in the array since they dont represent request info --->
<cfset foo = arraydeleteat(variables.requestparams,1)>
<cfset foo = arraydeleteat(variables.requestparams,1)>

You'll be left with an array representing the parameters that were passed in the original request. You can follow up on this by doing whatever analysis you need to on the url components to map it against the analogous pages in your CF site.

I'm surprised nobody has mentioned URL Rewriting. You can use mod_rewrite on *nix/apache, or ISAPI Rewrite or Ionics ISAPI Rewrite on Windows/IIS. I prefer Ionics if I'm on IIS.

The best bet is to do either a meta refresh in the actual homepage.asp page, it is quick and dirty, but works.

A better solution would be to have the .asp page do a 301 redirect to the new homepage, that way when search engines access the page as well they know it has moved.

What I do on Linux machines when I run into something like this is to create a symbolic link (ln -s /path/to/source /path/to/target).

Not sure what the Windows equivalent would be, so going with @Patrick's answer is probably best.

EDIT - The NTFS way of making a symlink:
http://en.wikipedia.org/wiki/NTFS_symbolic_link
see also http://en.wikipedia.org/wiki/Symbolic_link

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top