Changeset 8934
- Timestamp:
- 06/07/2019 04:30:34 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php
r8933 r8934 51 51 52 52 // Uppercase characters in URLs tend to lead to broken JS pages. 53 // This redirects any URLs that match /$slug or /browse/$section and have an uppercase URL to the lower-case variant. 53 // Redirect all paths to the lower-case variant, excluding searches.. 54 $path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ); 54 55 if ( 55 preg_match( '![A-Z]!', $_SERVER['REQUEST_URI'] ) && 56 ( 57 preg_match( '!^/themes/[^/]*[A-Z]+!', $_SERVER['REQUEST_URI'] ) || 58 '/themes/browse/' === strtolower( substr( $_SERVER['REQUEST_URI'], 0, 15 ) ) 59 ) 56 $path && 57 $path !== strtolower( $path ) && 58 ( is_search() && trailingslashit( $path ) !== '/themes/search/' . get_query_var( 's' ) . '/' ) 60 59 ) { 61 $url = trailingslashit( strtolower( remove_query_arg( array_keys( $_GET ), $_SERVER['REQUEST_URI'] ) ) ); 60 $url = preg_replace( 61 '|^' . preg_quote( $path, '|' ) . '|', 62 trailingslashit( strtolower( $path ) ), 63 $_SERVER['REQUEST_URI'] 64 ); 62 65 wp_safe_redirect( $url, 301 ); 63 66 die(); 64 67 } 65 68 66 // add a trailing slash to /browse/ requests67 if ( preg_match( '!^/themes/browse/([^/?]+)$!i', $_SERVER['REQUEST_URI']) ) {68 $url = trailingslashit($_SERVER['REQUEST_URI'] );69 // Ensure all requests are trailingslash'd. 70 if ( $oath && '/' !== substr( $path, -1 ) ) { 71 $url = str_replace( $path, $path . '/', $_SERVER['REQUEST_URI'] ); 69 72 wp_safe_redirect( $url, 301 ); 70 73 die();
Note: See TracChangeset
for help on using the changeset viewer.