mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 09:07:59 +01:00
Hex octets are case-insenstive. Don't 301 when the only octet case differs. Props hakre. fixes #14292 for 3.1
git-svn-id: http://svn.automattic.com/wordpress/trunk@15437 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4a037313e3
commit
d59d54b09d
@ -343,6 +343,24 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
|
||||
|
||||
if ( !$redirect_url || $redirect_url == $requested_url )
|
||||
return false;
|
||||
|
||||
// Hex encoded octets are case-insensitive.
|
||||
if ( false !== strpos($requested_url, '%') ) {
|
||||
if ( !function_exists('lowercase_octets') ) {
|
||||
function lowercase_octets($matches) {
|
||||
return strtolower( $matches[0] );
|
||||
}
|
||||
}
|
||||
$requested_url = preg_replace_callback('|%[a-fA-F0-9][a-fA-F0-9]|', 'lowercase_octets', $requested_url);
|
||||
}
|
||||
|
||||
// Hex encoded octets are case-insensitive.
|
||||
if ( false !== strpos($requested_url, '%') ) {
|
||||
function lowercase_octets($matches) {
|
||||
return strtolower($matches[0]);
|
||||
}
|
||||
$requested_url = preg_replace_callback('|%[a-fA-F0-9][a-fA-F0-9]|', 'lowercase_octets', $requested_url);
|
||||
}
|
||||
|
||||
// Note that you can use the "redirect_canonical" filter to cancel a canonical redirect for whatever reason by returning FALSE
|
||||
$redirect_url = apply_filters('redirect_canonical', $redirect_url, $requested_url);
|
||||
|
Loading…
Reference in New Issue
Block a user