#35184 closed defect (bug) (duplicate)
301 infinite redirect loop error on SOME posts
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.4 |
Component: | Permalinks | Keywords: | |
Focuses: | Cc: |
Description
I have thousands posts in my web site. Most of post URLs work great, however for some unknown (to me) reason many of them do not, resulting in:
*
This webpage has a redirect loop
ERR_TOO_MANY_REDIRECTS:
*
Below are a few samples of such "bad" links:
---
http://www.greenlightelectronics.com/electronic-part/MT49H16M36FM25A
http://www.greenlightelectronics.com/electronic-part/NIS5101E2T1G
http://www.greenlightelectronics.com/electronic-part/SEL3811B3125000
http://www.greenlightelectronics.com/electronic-part/LFE2M100E7FN900C
http://www.greenlightelectronics.com/electronic-part/MPC8360ZUALFHA
http://www.greenlightelectronics.com/electronic-part/EDFABA25SCAPCA11SNMP
http://www.greenlightelectronics.com/electronic-part/DWDMG10432TEJ01
http://www.greenlightelectronics.com/electronic-part/XC6VCX195T2FFG784I
http://www.greenlightelectronics.com/electronic-part/WINTC1C16091LCUPC
http://www.greenlightelectronics.com/electronic-part/100833351128RLF
http://www.greenlightelectronics.com/electronic-part/M3CWK2640K
http://www.greenlightelectronics.com/electronic-part/LM555CN
http://www.greenlightelectronics.com/electronic-part/XC5VLX155T1FF1136C
---
Please advice what is wrong in these post links.
And here is a sample of a good link, there are thousands of them:
http://www.greenlightelectronics.com/electronic-part/6MBP150NA060
---
In my Permalink Settings I have:
Custom Structure : /electronic-part/%postname%
--
Thank you
Change History (4)
#2
@
9 years ago
I'm not sure you're right.
Just found this patch (CORE!), which helped me. But I'm not sure if it does not impact on other functions.
Index: wp-includes/query.php =================================================================== --- wp-includes/query.php (revision 26965) +++ wp-includes/query.php (working copy) @@ -3923,6 +3923,10 @@ $query = $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta, $wpdb->posts WHERE ID = post_id AND post_type = %s AND meta_key = '_wp_old_slug' AND meta_value = %s", $post_type, $wp_query->query_vars['name']); + // Prevent a simple redirect loop due to values in '_wp_old_slug' not deleted + // when in an unpublished status. + $query .= $wpdb->prepare(" AND post_name != %s", $wp_query->query_vars['name']); + // if year, monthnum, or day have been specified, make our query more precise // just in case there are multiple identical _wp_old_slug values if ( '' != $wp_query->query_vars['year'] )
Hi and welcome to Trac.
Since it's not a consistent problem, it sounds like a support question, and not a core issue. Trac is intended for organizing the work on features and problems with WordPress core.
For support requests please see our forums at https://wordpress.org/support where someone will be able to assist you and go through proper troubleshooting steps to help you sort this out.