|
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Can't get 301 permanent redirect to work properly
A while back we restructured our site. This meant adding redirects on old pages for search engines, direct links etc.Scott Doc 12/10/08 12:18 A The company that I used to work at came across the same issue a whileSteve Keator 12/10/08 08:57 A Scott,Alan Rother 12/10/08 11:19 A | Why is that? And, more importantly, does this matter? ItHugo Ahlenius 12/11/08 04:06 A > So I added the following code on effected pages:Jochem van Dieten 12/13/08 04:25 A Thanks for the responses.Scott Doc 01/08/09 02:40 A I just confirmed that the following code did correctly return "HTTP/1.x 301 Moved permanently" under CF8. Sorry no CF5 available to test:Paul Cormier 01/08/09 10:34 A I removed the <cfabort> but still the same status when checking with firefoxScott Doc 01/09/09 12:03 A >Here's my actual page: http://www.wildasia.net/rt/Paul Cormier 01/09/09 10:32 A That's funny, when I hit the URL in IE with Fiddler on, I get the 302,brad 01/09/09 01:30 P Thanks Paul and Brad,Scott Doc 01/12/09 10:07 P > Looks like I'll have to ask the host about this one. I have no idea what CRLFCRLF is norDave Watts 01/12/09 10:16 P 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? 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? 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 | 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/ ----- 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 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. 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 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 ----- >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 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 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 > 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!
|
Mailing Lists
|
Latest Fusion Authority Articles
|
||||||