Make WordPress Core

Changeset 18822


Ignore:
Timestamp:
09/29/2011 09:47:04 PM (15 years ago)
Author:
ryan
Message:

Disallow indexing wp-admin and wp-includes in robots.txt. Props SergeyBiryukov. fixes #18465

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r18807 r18822  
    18471847        do_action( 'do_robotstxt' );
    18481848
    1849         $output = '';
     1849        $output = "User-agent: *\n";
    18501850        $public = get_option( 'blog_public' );
    18511851        if ( '0' ==  $public ) {
    1852                 $output .= "User-agent: *\n";
    18531852                $output .= "Disallow: /\n";
    18541853        } else {
    1855                 $output .= "User-agent: *\n";
    1856                 $output .= "Disallow:\n";
     1854                $site_url = parse_url( site_url() );
     1855                $path = ( !empty( $site_url['path'] ) ) ? $site_url['path'] : '';
     1856                $output .= "Disallow: $path/wp-admin/\n";
     1857                $output .= "Disallow: $path/wp-includes/\n";
    18571858        }
    18581859
Note: See TracChangeset for help on using the changeset viewer.