douyi1197 2017-11-20 23:41
浏览 114
已采纳

wordpress - 如何noindex插件文件夹,但不阻止它们

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?

  • 写回答

1条回答 默认 最新

  • dtkl55257 2017-11-21 00:16
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?