phpwordpress.htaccessseonoindex

wordpress - How to noindex plugin folders, but not block them


I've searched but haven't found quite what I need. What I'm trying to do is noindex a plugin folders. Google for some reason has indexed a bunch of urls like this for example: /wp-content/plugins/LayerSlider/static/public

All that pulls up is a "Index of" page, so I'd like to get that and urls like it noindexed. I don't want to just block them with the robots file though because after reading the following article, it seems like a bad idea: WordPress robots.txt example for great SEO

There's also this to backup why blocking any css and js is a bad idea: Google Panda 4, and blocking your CSS & JS

There's no index file or anything like that, so I'm wondering if there's a way to get these noindexed. Perhaps the htaccess file?


Solution

  • You can use .htaccess file to add X-Robots-Tag header.

    For example create new .htaccess file inside plugins directory and put this code inside it will add the header to all the files inside the folder.

    <IfModule mod_headers.c>
    Header set X-Robots-Tag "noindex, nofollow"
    </IfModule>
    

    Make sure you have the headers modules installed / active.