Make WordPress Core

Ticket #13115: 13115-v2.patch

File 13115-v2.patch, 890 bytes (added by solarissmoke, 15 years ago)

add robots.txt rewrite rule only if wp is installed in root directory

  • rewrite.php

     
    15641564                if ( empty($this->permalink_structure) )
    15651565                        return $rewrite;
    15661566
    1567                 // robots.txt
    1568                 $robots_rewrite = array('robots\.txt$' => $this->index . '?robots=1');
    1569 
     1567                // robots.txt - this is only needed if wordpress is installed at the root of a domain
     1568                $home_path = parse_url(home_url());
     1569                $robots_rewrite = ( !isset($home_path['path']) || $home_path['path'] == '/' ) ? array('robots\.txt$' => $this->index . '?robots=1') : array();
     1570                       
    15701571                //Default Feed rules - These are require to allow for the direct access files to work with permalink structure starting with %category%
    15711572                $default_feeds = array( '.*wp-atom.php$'        =>      $this->index . '?feed=atom',
    15721573                                                                '.*wp-rdf.php$'         =>      $this->index . '?feed=rdf',