In ColdFusion, redirects can be done via one of two methods. The method you use will depend on the reason for the redirect.
Temporary Redirects (
This is the most commonly used of the two — you will probably find yourself using the
<cflocation> tag often.
A temporary redirect is typically used when you need to redirect the user to another page based on some logical rule in your program. For example, straight after they submit a form, the browser might redirect to another page.
ColdFusion includes the
<cflocation> tag for performing temporary redirects. This actually sends HTTP headers to the user's browser indicating a 302 status code, which means "Moved Temporarily".
A permanent redirect should be used when a page no longer exists.
Permanent redirects use the 301 HTTP status code, which means, "Moved Permanently". In ColdFusion, a permanent redirect can be achieved using the
In case you're thinking, "but users can't see the status code anyway", that's only partially true. The 301 status code can be very useful for search engines. They will actually take notice of your 301 status code and index the correct file.