301 Redirects and the people who love 'em...

robbluther's picture

He has: 73 posts

Joined: Jan 2006

Can you do a 301 redirect after putting info into a DB? i.e. Form submits... processes and redirects to same form page based on IRL parameter.

Has anyone ever done this in Cold Fusion?

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

You can do it in PHP, so I'm sure you could do it in cold Fusion though.

In PHP, there is a header function that you pass "location: {url}" to redirect. You just call that after procssing the form before any other output is sent to the browser.

-Greg

PS. I did some searching, and found this page which might have what you are looking for: http://www.webconfs.com/how-to-redirect-a-webpage.php

robbluther's picture

He has: 73 posts

Joined: Jan 2006

It did work... The code presented on the webconfs forum called for the code to be as such...
<.cfheader statuscode="301" statustext="Moved permanently">
<.cfheader name="Location" value="http://www.new-url.com">

When I plugged that into my .cfm page it did not work. The script appeared as though I typed it in to be presented as text...
I midified the code and took out the periods like so and included my variable...

That worked perfect.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.