From 10a2e478907a46e73b5f6741f8b587834171c255 Mon Sep 17 00:00:00 2001 From: nacin Date: Wed, 28 Apr 2010 06:37:15 +0000 Subject: [PATCH] Don't serve dynamic robots.txt when WP is not installed at the root of a domain. props solarissmoke, fixes #13115 git-svn-id: http://svn.automattic.com/wordpress/trunk@14273 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/rewrite.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index 2274982a2..d193f53a8 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -1564,10 +1564,11 @@ class WP_Rewrite { if ( empty($this->permalink_structure) ) return $rewrite; - // robots.txt - $robots_rewrite = array('robots\.txt$' => $this->index . '?robots=1'); - - //Default Feed rules - These are require to allow for the direct access files to work with permalink structure starting with %category% + // robots.txt -only if installed at the root + $home_path = parse_url( home_url() ); + $robots_rewrite = ( empty( $home_path['path'] ) || '/' == $home_path['path'] ) ? array( 'robots\.txt$' => $this->index . '?robots=1' ) : array(); + + // Default Feed rules - These are require to allow for the direct access files to work with permalink structure starting with %category% $default_feeds = array( '.*wp-atom.php$' => $this->index . '?feed=atom', '.*wp-rdf.php$' => $this->index . '?feed=rdf', '.*wp-rss.php$' => $this->index . '?feed=rss',