Skip to main content
Inspiring
November 7, 2010
Question

the correct code to implement 301 URL Redirection

  • November 7, 2010
  • 2 replies
  • 593 views

I have to permanently move a few pages, from http://www.site.com/page.cfm   to   http://www.site.com/new/page.cfm  but also to preserve page rank for each one of them. So, is this the correct code to implement 301 URL Redirection?

<.cfheader statuscode="301" statustext="Moved permanently">
<.cfheader name="Location" value="
http://www.site.com/new/page.cfm">

also can I delete http://www.site.com/page.cfm  page after redirecting?

    This topic has been closed for replies.

    2 replies

    Community Expert
    November 7, 2010

    Yes, that code looks fine to do a permanent redirect. You could also use CFLOCATION instead:

    <cflocation url="..." statuscode="301">

    Or, as Adam points out, you could do this through your web server's own native functionality if you chose.

    I wouldn't recommend deleting the original page as long as references to that page's URL exist anywhere.

    Dave Watts, CTO, Fig Leaf Software

    http://www.figleaf.com/

    http://training.figleaf.com/

    Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on

    GSA Schedule, and provides the highest caliber vendor-authorized

    instruction at our training centers, online, or onsite.

    Read this before you post:

    http://forums.adobe.com/thread/607238

    Dave Watts, Eidolon LLC
    pirula08Author
    Inspiring
    November 8, 2010

    You could also use CFLOCATION instead:

    yep but there is only one problem here, I am still running old CF MX 7 (plan to upgrade to CF 8 after new year ) and as far as I know statuscode is not supported in version 7. I'll try with IIS for now.

    Inspiring
    November 7, 2010

    I wouldn't pester CF with this sort of thing: it's a job for the web server.

    --

    Adam