HTTP redirect should return a hypertext fragment
|Reported by:||hakre||Owned by:|
When WordPress redirects via the API (wp_redirect), a useragent which does not automatically redirect (e.g. configuration because of usability or security considerations), get's a blank page delivered (which is of no use for the user). This is because only HTTP headers are set for the redirect, but not a HTTP body. Normally Webservers and Webapplications deliver a body as well.
Example: Redirect on the google.com domain
Command: curl -i http://google.com/
HTTP/1.1 301 Moved Permanently Location: http://www.google.com/ Content-Type: text/html; charset=UTF-8 Date: Tue, 15 Jun 2010 18:11:12 GMT Expires: Thu, 15 Jul 2010 18:11:12 GMT Cache-Control: public, max-age=2592000 Server: gws Content-Length: 219 X-XSS-Protection: 1; mode=block <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> <TITLE>301 Moved</TITLE></HEAD><BODY> <H1>301 Moved</H1> The document has moved <A HREF="http://www.google.com/">here</A>. </BODY></HTML>
Redirect of google.com to www.google.com; next to the headers a body is returned (some simple HTML containing the link to the redirected page).
This method is often used as a fall-back for automatic methods — if the visitor's browser does not support the automatic redirect method, the visitor can still reach the target document by following the link. URL redirection (From Wikipedia, the free encyclopedia)
Example: Redirect on a wordpress domain
This is against a trunk version wordpress setup. I made a setup with a domain www.webroot.loc and webroot.loc. The blog is w/o the www. so www.webroot.loc get's redirected to webroot.loc:
Command: curl -i http://www.webroot.loc/wordpress/
HTTP/1.1 301 Moved Permanently Date: Tue, 15 Jun 2010 18:12:38 GMT Server: Apache X-Pingback: http://webroot.loc/wordpress/xmlrpc.php Location: http://webroot.loc/wordpress/ Transfer-Encoding: chunked Content-Type: text/html; charset=UTF-8
There is no http body in the response.
To increase the overall usability of wordpress a body should returned as well.
Change History (22)
- Keywords needs-patch added; has-patch tested removed
- Milestone changed from 3.1 to Future Release
- Summary changed from Redirect does not return a HTTP body to HTTP redirect should return a hypertext fragment