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
This commit is contained in:
nacin 2010-04-28 06:37:15 +00:00
parent 6636a27c38
commit 10a2e47890
1 changed files with 5 additions and 4 deletions

View File

@ -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');
// 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 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',