[wp-trac] Re: [WordPress Trac] #8098: trailing p's removed from query by canonical redirect

WordPress Trac wp-trac at lists.automattic.com
Mon Nov 10 04:54:35 GMT 2008


#8098: trailing p's removed from query by canonical redirect
-----------------------------------+----------------------------------------
 Reporter:  DD32                   |        Owner:  anonymous
     Type:  defect                 |       Status:  new      
 Priority:  normal                 |    Milestone:  2.7      
Component:  General                |      Version:  2.7      
 Severity:  normal                 |   Resolution:           
 Keywords:  has-patch 2nd-opinion  |  
-----------------------------------+----------------------------------------
Comment (by filosofo):

 Replying to [comment:16 stevish]:
 > Am I missing anything?

 In theory it's possible the query string could be like {{{'&tag=php&p='}}}
 or {{{'tag=php&p=&'}}}, in which case there are leftover "&"s.

 How about this?  It seems to handle all of the as-yet-mentioned examples:

 {{{$redirect['query'] = preg_replace(
 '#^&|(&(?!(?P<q>\b(p|page_id|cat|tag)\b)=?&.))?(?<!=)(?P>q)=?(&|$)|&$#',
 '', $redirect['query'] );}}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/8098#comment:17>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list