mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Canonical: Ensure that when permalinks are set to a trailing slash, that robots.txt doesn't.
Fixes #48025. Props Toro_Unit, joostdevalk, SergeyBiryukov. Built from https://develop.svn.wordpress.org/trunk@48153 git-svn-id: http://core.svn.wordpress.org/trunk@47922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4f69c150b7
commit
bb7a531b75
@ -58,8 +58,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
||||
}
|
||||
|
||||
if ( is_admin() || is_search() || is_preview() || is_trackback()
|
||||
|| is_robots() || is_favicon()
|
||||
|| ( $is_IIS && ! iis7_supports_permalinks() )
|
||||
|| is_favicon() || ( $is_IIS && ! iis7_supports_permalinks() )
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@ -683,6 +682,11 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
||||
$redirect['host'] = $original['host'];
|
||||
}
|
||||
|
||||
// Even if the permalink structure ends with a slash, remove slash robots.txt.
|
||||
if ( is_robots() ) {
|
||||
$redirect['path'] = untrailingslashit( $redirect['path'] );
|
||||
}
|
||||
|
||||
$compare_original = array( $original['host'], $original['path'] );
|
||||
|
||||
if ( ! empty( $original['port'] ) ) {
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-alpha-48152';
|
||||
$wp_version = '5.5-alpha-48153';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user