Don't serve dynamic robots.txt when WP is not installed at the root of a domain. props solarissmoke, fixes #13115

git-svn-id: https://develop.svn.wordpress.org/trunk@14273 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2010-04-28 06:37:15 +00:00
parent caa53c4982
commit a3d0926168
1 changed files with 5 additions and 4 deletions

View File

@ -1564,10 +1564,11 @@ class WP_Rewrite {
if ( empty($this->permalink_structure) ) if ( empty($this->permalink_structure) )
return $rewrite; return $rewrite;
// robots.txt // robots.txt -only if installed at the root
$robots_rewrite = array('robots\.txt$' => $this->index . '?robots=1'); $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', $default_feeds = array( '.*wp-atom.php$' => $this->index . '?feed=atom',
'.*wp-rdf.php$' => $this->index . '?feed=rdf', '.*wp-rdf.php$' => $this->index . '?feed=rdf',
'.*wp-rss.php$' => $this->index . '?feed=rss', '.*wp-rss.php$' => $this->index . '?feed=rss',