House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

HTTP 301 redirects using CFHTTP?

  << Previous Post |  RSS |  Tree View |  Sort Latest First |  Subscribe to this Group Next >> 

HTTP 301 redirects using CFHTTP?

I'm rolling out a newly redesigned site and need to implement a bunch Pete Ruckelshaus 07/31/2006 11:28 PM
CFHTTP has no place in this. James Holmes 08/01/2006 12:24 AM
OK, thanks James, that was the shove in the right direction that I Pete Ruckelshaus 08/01/2006 07:46 AM
If there are going to be only 100 URL's, and they are not going to change Russ 08/01/2006 10:25 AM

07/31/2006 11:28 PM
Author: Pete Ruckelshaus Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:47057#248374 I'm rolling out a newly redesigned site and need to implement a bunch of redirects that return an HTTP response code of 301 (Moved Permanently).  There will be a database table (loaded into memory) that will have the bad & good URL's.  Has anyone here done this, specifically the redirect that results in a 301 response code? Thanks, Pete
08/01/2006 12:24 AM
Author: James Holmes Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:47057#248376 CFHTTP has no place in this. You need CFHEADER if you are doing it via CF. > I'm rolling out a newly redesigned site and need to implement a bunch > of redirects that return an HTTP response code of 301 (Moved > Permanently).  There will be a database table (loaded into memory) > that will have the bad & good URL's.  Has anyone here done this, > specifically the redirect that results in a 301 response code? -- CFAJAX docs and other useful articles: http://www.bifrost.com.au/blog/
08/01/2006 07:46 AM
Author: Pete Ruckelshaus Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:47057#248391 OK, thanks James, that was the shove in the right direction that I needed.  In case anyone else is looking for the same answer, here's my test code that works: <cfscript>   qryRedirect = queryNew("oldurl,newurl","varchar,varchar");   tmp = queryAddRow(qryRedirect);   tmp = querySetCell(qryRedirect,"oldurl","http://localhost/test/404/nothere.html");   tmp = querySetCell(qryRedirect,"newurl","http://localhost/test/404/goodurl.cfm");   attemptedURL = "http://" & CGI.server_name & CGI.script_name;   generatedURL = getToken(CGI.query_string, 2, ";"); </cfscript> <cfquery name="checkURL" dbtype="query">   SELECT   newurl   FROM  qryRedirect   WHERE  oldurl = '#generatedURL#' </cfquery> <cfif checkURL.recordcount EQ 1>   <cfheader name="Location" value="#checkurl.newurl#">   <cfheader statuscode="301" statustext="Moved Permanently"> <cfelse>   <cflocation url="/404.cfm"> </cfif> Ultimately I will have the redirects in a database which I will load into memory (via the application scope) for faster access.  Memory usage won't be an issue, there's only 100 or so URL's to redirect.  If anyone sees any issues with this code, please let me know. Thanks, Pete
08/01/2006 10:25 AM
Author: Russ Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:47057#248414 If there are going to be only 100 URL's, and they are not going to change often, and you have access to the server, I would suggest doing it in apache or even IIS, as that's going to take a lot of load off your cf server... You can generate the rules using cf from the db, write it to a file and then have apache or iis rewrite use it... Russ ----- Excess quoted text cut - see Original Post for more -----
<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

March 18, 2010

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
   1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31