WordPress.org

Ready to get started?Download WordPress

Forums

iThemes Security (formerly Better WP Security)
[Plugin: Better WP Security] Please add renaming of wp-content to the dynamic robots.txt (2 posts)

  1. Fee
    Member
    Posted 2 years ago #

    First of all: Thank you very much for this wonderful plugin. I'm using WP multisite and it's working excellent in my installation. (Ok, it was not easy to configure for multisite and needed direct changes in the database, but I got it).

    I'm sorry not to write in your support forum, but there never came an activation email after registering.

    Today I recognized that the dynamically generated robots.txt still contains the default wp-content name:
    Disallow: /wp-content/plugins
    Disallow: /wp-content/cache
    Disallow: /wp-content/themes

    For a really even better security it's a must that this is changed to the new directory name, or just added below:
    Disallow: /mydirname/plugins
    Disallow: /mydirname/cache
    Disallow: /mydirname/themes

    Could you please add this feature to your next release?

    I saw it in other pulgins working like SEO Ultimate, that something is added to this robots.txt.

    http://wordpress.org/extend/plugins/better-wp-security/

  2. Fee
    Member
    Posted 2 years ago #

    ok, I've found it. The lines with wp-content were added by another plugin. But whynot take this and add it as feature?

    The hook is in wp-includes/functions.php line 1845 do_robots()

    Something like this (didn't try it):

    function do_robots() {
    	remove_action('do_robots', 'do_robots');
    	header( 'Content-Type: text/plain; charset=utf-8' );
    	do_action( 'do_robotstxt' );
    	$dirname = getDir();
    	echo "User-agent: *\n";
    	echo "Disallow: /wp-login.php\n";
    	echo "Disallow: /".$dirname."/plugins\n";
    	echo "Disallow: /".$dirname."/cache\n";
    	echo "Disallow: /".$dirname."/themes\n";
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic