===================================================================== An iEntry.com Mailing ===================================================================== DevWebProCA - Automatically Pushing To A New URL Made Simpler June 11, 2007 http://www.DevWebProCA.com ..................................................................... Microsoft Expression Web - See for yourself how state-of-the-art tools can put the power of CSS in your hands. Download the 60-day trial now. http://aj.600z.com/aj/29349/0/cc?z=1&b=28151&c=29345 ..................................................................... Automatically Pushing To A New URL Made Simpler Raymond Camden | Expert Author When I was preparing to move my site from: http://ray.camdenfamily.com to http://www.coldfusionjedi.com I certainly didn't want all of my old URLs to stop working. I wrote some quick code (literally, I forgot to write the code before hand so I wrote it live on the old server) to handle this. Here is what I did... First off - I read Pete Freitag's excellent blog post, What CFLOCATION Does, where he talks about how the status code sent out by CFLOCATION is intended for temporary move, not a permanent one. Using the code he suggested, I added a cfheader to my site. However, I have two styles of URLs. I have both traditional query_string style: http://ray.camdenfamily.com/index.cfm?mode=entry&entry=XXXX And my SEO style cgi.path_info style: http://ray.camdenfamily.com/index.cfm/noone/reads/code/samples So I needed code to notice either of these two forms. This is what I came up with: &nbps; ..................................................................... Easily Meet Online with Zero Hassle and Zero Travel. Try WebEX MeetMeNow for FREE! http://aj.600z.com/aj/29349/0/cc?z=1&b=29172&c=29346 ..................................................................... As you can see - I check both cgi.query_string and cgi.path_info. Depending on what is used, I build up my new URL in a variable called loc. I can then push the user there using the two cfheader tags. Now how does ColdFusion 8 make this easier? The cflocation tag has been updated to allow you to pass in a status code. There is a set of valid status codes, of which 301 is one of them. The two tags above would become one. (Actually I'd be able to get rid of the cfabort as well.) ===================================================================== About the Author: Raymond Camden is Vice President of Technology for roundpeg, Inc. A long time ColdFusion user, Raymond has worked on numerous ColdFusion books and is the creator of many of the most popular ColdFusion community web sites. He is an Adobe Community Expert, user group manager, and the proud father of three little bundles of joy. http://ray.camdenfamily.com ===================================================================== ===================================================================== For ad details and prices... mailto:susan@ientry.com ===================================================================== Signup for free newsletters: http://www.ientry.com/page/newsletters ===================================================================== --- DevWebProCA is an iEntry.com publication --- http://www.iEntry.com iEntry, Inc. 2549 Richmond Rd Second Floor Lexington, KY 40509 ====================================================================