House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Can't get 301 permanent redirect to work properly

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Scott Doc
12/10/2008 12:18 AM

A while back we restructured our site. This meant adding redirects on old pages for search engines, direct links etc. So I added the following code on effected pages: <cfheader statuscode="301" statustext="Moved permanently"> <cfheader name="Location" value="http://www.example.net/test.cfm?page=4">; <cfabort> Recently I checked our redirects with a tool found here: http://www.seoconsultants.com/tools/headers.asp It reported that it was receiving an HTTP Status Code of: HTTP/1.1 302 Object Moved Why is that? And, more importantly, does this matter? It seems it has "moved" it isn't a "302 Found" but it isn't a 301 either... I'm confused. Why is it ignoring my cfheader statuscode?

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Steve Keator
12/10/2008 08:57 AM

The company that I used to work at came across the same issue a while back.  We found that it was actually the redirect tester itself, and not the CF redirects, that was reporting 302's incorrectly.  Consider checking a few alternate sources to make sure it is not that particular redirect tester giving you a false report. If, for some reason, you are still seeing 302's on other redirect testers, and you're using IIS, you might want to consider setting them up directly within. -S. A while back we restructured our site. This meant adding redirects on old pages for search engines, direct links etc. So I added the following code on effected pages: <cfheader statuscode="301" statustext="Moved permanently"> <cfheader name="Location" value="http://www.example.net/test.cfm?page=4">; <cfabort> Recently I checked our redirects with a tool found here: http://www.seoconsultants.com/tools/headers.asp It reported that it was receiving an HTTP Status Code of: HTTP/1.1 302 Object Moved Why is that? And, more importantly, does this matter? It seems it has "moved" it isn't a "302 Found" but it isn't a 301 either... I'm confused. Why is it ignoring my cfheader statuscode?

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Alan Rother
12/10/2008 11:19 AM

Scott, If you want to be sure it's working I'd recommend testing the headers yourself. Open up firefox and download the HttpFox plugin. It will allow you to see all of the raw response headers a page generates on the fly. We had a similar project and it was the only way we could validate it to the client. They actually wanted a way to SEE that it worked. =] -- Alan Rother Adobe Certified Advanced ColdFusion MX 7 Developer Manager, Phoenix Cold Fusion User Group, AZCFUG.org

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Hugo Ahlenius
12/11/2008 04:06 AM

| Why is that? And, more importantly, does this matter? It | seems it has "moved" it isn't a "302 Found" but it isn't a | 301 either... I'm confused. Why is it ignoring my cfheader statuscode? cURL is such a handy tool: curl -I http://www.example.net/test.cfm?page=4 Get it here, if it is not in your linux distro or cygwin installation already: http://curl.haxx.se/

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jochem van Dieten
12/13/2008 04:25 AM

----- Excess quoted text cut - see Original Post for more ----- I have seen that behavior as well. Haven't had a chance to investigate it and/or file a bug yet. > Why is that? And, more importantly, does this matter? It matters to search engines. If you want to rank high you really shouldn't move pages around, but if you do a 301 will be picked up much better then a 302. What you could try is a cflocation with the statusCode attribute (new in CF 8). Jochem

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Scott Doc
01/08/2009 02:40 AM

Thanks for the responses. First off, apologies to HouseOfFusion - I duplicated this thread because something was wrong or slow at the time and I didn't think my posting went through: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:58281 I downloaded the firefox plug-in, but it also reported a 302. What's worse, the resulting page came up as a 200 - text/plain. So it rendered the html as plain text in the browser. This didn't happen on Safari (yes, I'm a mac user) So, I really would like to know how to fix this. I'm using CF 5 - so I don't think I can do a "bug report" .. too old. Also to old to implement any cool new CF8 features. Would be nice to use CF8 .. but alas, we don't.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Paul Cormier
01/08/2009 10:34 AM

I just confirmed that the following code did correctly return "HTTP/1.x 301 Moved permanently" under CF8. Sorry no CF5 available to test: <cfheader statuscode="301" statustext="Moved permanently"> <cfheader name="Location" value="http://www.besthomepro.com/">; Try removing the <cfabort>. Paul Cormier

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Scott Doc
01/09/2009 12:03 AM

I removed the <cfabort> but still the same status when checking with firefox return: HTTP/1.1 302 Object Moved My code is the same as yours below (except, obviously, the value of the second line) Here's my actual page: http://www.wildasia.net/rt/ ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Paul Cormier
01/09/2009 10:32 AM

>Here's my actual page: http://www.wildasia.net/rt/ OK, I believe one of two things may be happening: 1. Is there a web proxy somewhere in the chain? If possible, try it again from a web browser right on the server. 2. Your IIS install/ColdFusion connector is hosed. Not only do I get a 302 redirect from your link, but the page it redirects to, main.cfm doesn't render in the browser, instead I get prompted to download the source file (which it does, yikes!). That looks like an IIS problem. Paul Cormier

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
brad
01/09/2009 01:30 PM

That's funny, when I hit the URL in IE with Fiddler on, I get the 302, and then Fiddler throws a warning that the next header to come back is malformed: "The Server did not return properly formatted HTTP Headers. HTTP headers should be terminated with CRLFCRLF.  These were terminated with LFCRLF." ~Brad >Here's my actual page: http://www.wildasia.net/rt/ OK, I believe one of two things may be happening: 1. Is there a web proxy somewhere in the chain? If possible, try it again from a web browser right on the server. 2. Your IIS install/ColdFusion connector is hosed. Not only do I get a 302 redirect from your link, but the page it redirects to, main.cfm doesn't render in the browser, instead I get prompted to download the source file (which it does, yikes!). That looks like an IIS problem. Paul Cormier

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Scott Doc
01/12/2009 10:07 PM

Thanks Paul and Brad, Looks like I'll have to ask the host about this one. I have no idea what CRLFCRLF is nor anything about web proxies or IIS.. a bit beyond me. And yes, the downloading the source must be why it is rendered as text in the browser. Strange indeed. Cheers

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dave Watts
01/12/2009 10:16 PM

> Looks like I'll have to ask the host about this one. I have no idea what CRLFCRLF is nor > anything about web proxies or IIS.. a bit beyond me. And yes, the downloading the source > must be why it is rendered as text in the browser. Strange indeed. "CRLF" is carriage return and line feed. Your server isn't sending back the initial carriage return, according to Brad's Fiddler trace. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information!


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

March 21, 2010

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
   1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31