views:

106

answers:

5

I recently converted a site from asp to CF. Unfortunately, alot of the old users had the "homepage" bookmarked. www.thedomain.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

A: 

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.

Mitchel Sellers
I like your second idea, but am unfamiliar. Can you point me to an example? Thanks
Gene R
Nevermind, I googled it, pretty simple. Thanks again!
Gene R
+6  A: 

Put this in the old homepage.asp

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

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

warren
I don't know how it is in Linux, but in Windows I find symbolic links like this to be very dangerous as (let's say) new administrators don't realise that the folder and scripts they are about to delete are in fact the only instance and not the duplicate they naturally expect it to be...
Cirieno
+2  A: 

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.

Andy Waschick
+2  A: 

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.

Adam Tuttle