Gene R
Gene R

Reputation: 1565

Bookmarked page redirect

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

Upvotes: 2

Views: 289

Answers (5)

Adam Tuttle
Adam Tuttle

Reputation: 19804

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.

Upvotes: 2

Andy Waschick
Andy Waschick

Reputation: 51

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.

Upvotes: 2

warren
warren

Reputation: 33445

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

Upvotes: 0

Patrick McElhaney
Patrick McElhaney

Reputation: 59271

Put this in the old homepage.asp

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

Upvotes: 6

Mitchel Sellers
Mitchel Sellers

Reputation: 63126

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.

Upvotes: 0

Related Questions