First, i’ve searched by robots.txt for WordPress, but, no one told me where is this file. So, I read that the robots.txt in WordPress is virtual.
Ok, no problem. But, where i find this to edit? My WordPress is allowing the /author/admin and i don’t want this.
In dashboard, the only option for something like this is too general, like “block search engine to find this website” (something like this).
Anyone knows a solution?
4
Answers
You must create your own robots.txt file in root directory which will override the virtual file or use a plugin for that.
There’s an undocumented robots_txt hook which you can use to customize the virtual robots.txt file. It takes two parameters: the full content of the robots.txt file that WordPress generated, and a boolean value showing whether the site is “public” (open to search engines) or not.
You can add your own filter to this hook and add that URL to the virtual robots.txt with code like this in a plugin or your theme’s
functions.php
file:If you are not familiar with robots.txt and you’re ok to install a good plugin you can try WP SEO by Yoast that include a tool for generate a custom robots.txt and much more. Here is the link: https://wordpress.org/plugins/wordpress-seo/
Hope it helps.
You should create your own robots.txt file and upload it to website root directory.
Follow the following steps to create and upload into root folder:
Add the following text into this file, remember add also your website sitemap path
Save as robots.txt
Copy and paste this file into root directory
In that way your robots.txt file will be updated and will be shown in directory.
Finally go to webmaster account in robots.txt section. You can test that file and you can submit that file too.