Skip to main content
Participating Frequently
October 21, 2009
Question

Problem with 301 redirect

  • October 21, 2009
  • 1 reply
  • 1088 views

We moved our site from one domain to another  in the application.cfm on the old domain I analyze incoming CGI.SCRIPT_NAME, divide URL into composite parts and form new links into  tmpRedirectPath variable and after that make redirect to new links using new domain name:

<cfheader statuscode="301" statustext="Moved permanently">
<cfheader name="location" value="http://www.newsite.com/#tmpRedirectPath#">

Everything works, BUT in the address line of browser stay old URL.

Why this happend? Could I do something to change URL to new together with redirect?

    This topic has been closed for replies.

    1 reply

    Inspiring
    October 22, 2009

    Curious.  Are you seeing this on all browsers?

    Can you post some code that demonstrates this?

    --

    Adam

    S_martAuthor
    Participating Frequently
    October 26, 2009

    Here is the code that present in the application.cfm on the old domain:

    <cfset tmpRedirectPath = "">
    <cfif Find("topic.cfm",CGI.SCRIPT_NAME) and isDefined("URL.topicID") and (ListFind("2,12,13,15,16,17,18,19,21,25,28",val(URL.topicID)))>
        <cfswitch expression="#val(URL.topicID)#">
            <cfcase value="18"><cfset tmpRedirectPath = "topic-seo-name-first/"></cfcase>
            ...
            <cfcase value="25"><cfset tmpRedirectPath = "topic-seo-name-second/"></cfcase>
        </cfswitch>
    <cfelseif (Find("categories.cfm",CGI.SCRIPT_NAME) or Find("categoriesABC.cfm",CGI.SCRIPT_NAME)) and isDefined("URL.catID")>
        <cfquery name="qry_Sel">...</cfquery>
        <cfset tmpRedirectPath = qry_Sel.pageLink>
    <cfelseif Find("links.cfm",CGI.SCRIPT_NAME)>
        <cfset tmpRedirectPath = "new-links-page.cfm">
    </cfif>

    <cfheader statuscode="301" statustext="Moved permanently">
    <cfheader name="location" value="http://www.NewSite.com/#tmpRedirectPath#">
    <cfabort>