Skip to content

Commit f0aa4ec

Browse files
Site Health: Correct the check for a static robots.txt file.
This ensures that the file existence is properly detected when WordPress is located in a subdirectory while the home URL points to the website root. Follow-up to [59890]. Props timse201, mukesh27. Fixes #64580. git-svn-id: https://develop.svn.wordpress.org/trunk@61577 602fd350-edb4-49c9-b593-d223f7449a82
1 parent f4f33f7 commit f0aa4ec

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/wp-admin/includes/class-wp-debug-data.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -505,12 +505,12 @@ private static function get_wp_server(): array {
505505
}
506506

507507
// Check if a robots.txt file exists.
508-
if ( is_file( ABSPATH . 'robots.txt' ) ) {
508+
if ( is_file( get_home_path() . 'robots.txt' ) ) {
509509
// If the file exists, turn debug info to true.
510510
$robotstxt_debug = true;
511511

512512
/* translators: %s: robots.txt */
513-
$robotstxt_string = sprintf( __( 'There is a static %s file in your installation folder. WordPress cannot dynamically serve one.' ), 'robots.txt' );
513+
$robotstxt_string = sprintf( __( 'Your site is using a static %s file. WordPress cannot dynamically serve one.' ), 'robots.txt' );
514514
} elseif ( got_url_rewrite() ) {
515515
// No robots.txt file available and rewrite rules in place, turn debug info to false.
516516
$robotstxt_debug = false;
@@ -522,7 +522,7 @@ private static function get_wp_server(): array {
522522
$robotstxt_debug = true;
523523

524524
/* translators: %s: robots.txt */
525-
$robotstxt_string = sprintf( __( 'WordPress cannot dynamically serve a %s file due to a lack of rewrite rule support' ), 'robots.txt' );
525+
$robotstxt_string = sprintf( __( 'WordPress cannot dynamically serve a %s file due to a lack of rewrite rule support.' ), 'robots.txt' );
526526

527527
}
528528

0 commit comments

Comments
 (0)