[wp-trac] Re: [WordPress Trac] #5760: Infinite redirect loop on
archive pages for days/months/years
WordPress Trac
wp-trac at lists.automattic.com
Wed Feb 6 20:41:47 GMT 2008
#5760: Infinite redirect loop on archive pages for days/months/years
-----------------------------------------------------+----------------------
Reporter: roganty | Owner: markjaquith
Type: defect | Status: new
Priority: normal | Milestone: 2.6
Component: General | Version: 2.3.2
Severity: normal | Resolution:
Keywords: canonical, url, date, archive, redirect |
-----------------------------------------------------+----------------------
Comment (by roganty):
I have been doing a little bit of digging around in canonical.php and have
found that $requested_url is never the same as $redirect_url
The following bit of code shows some print statements and die() functions
that I have added to canonical.php
{{{
function redirect_canonical($requested_url=NULL, $do_redirect=true) {
global $wp_rewrite, $posts, $is_IIS;
print "\r\n<br />".$requested_url." ";
[...cut...]
if ( $redirect_url && $redirect_url != $requested_url ) {
// var_dump($redirect_url); die();
print "1:".$redirect_url."|".$requested_url." ";
$redirect_url = apply_filters('redirect_canonical',
$redirect_url, $requested_url);
if ( $do_redirect) {
print "2:".$redirect_url."|".$requested_url." ";
// protect against chained redirects
if ( !redirect_canonical($redirect_url, false) ) {
print "3:".$redirect_url."|".$requested_url." ";
die("Die:1");
wp_redirect($redirect_url, 301);
exit();
} else {
die("Die:2");
return false;
}
} else {
die("Die:3");
return $redirect_url;
}
} else {
#die("Die:4");
print "FALSE ";
return false;
}
}}}
If I go to [http://www.roganty.co.uk/blog/2007/12/ /blog/2007/12/] I get
the following output:
{{{
<br />
1:http://www.roganty.co.uk/blog/2007/12/|http://www.roganty.co.uk/blog/index.php?year=2007&monthnum=12
2:http://www.roganty.co.uk/blog/2007/12/|http://www.roganty.co.uk/blog/index.php?year=2007&monthnum=12
<br />http://www.roganty.co.uk/blog/2007/12/
FALSE3:http://www.roganty.co.uk/blog/2007/12/|http://www.roganty.co.uk/blog/index.php?year=2007&monthnum=12
Die:1
}}}
On any other page I get the following output (followed by the rest of the
page):
{{{
<br /> FALSE
}}}
--
Ticket URL: <http://trac.wordpress.org/ticket/5760#comment:4>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list