How to stop WordPress showing a virtual Robots.txt?

I can see the robots.txt file here :

http://persian.cc/robots.txt

But Google can’t !

I know that I can find robots.txt files in the root of a website, but hey there is no robots.txt file in mine and this robots.txt is a virtual one being made by WordPress. Now how to stop wordpress doing that?

OR If I cannot stop wordpress showing that virtual robots.txt file, how can I stop Google looking for it on my website? maybe a .htaccess code or something?

1 Answer
1

Two options:

  1. Create a static file robots.txt. Highly recommended.

  2. Filter 'robots_txt':

    add_filter( 'robots_txt', 'wpse_77969_robots' );
    
    function wpse_77969_robots()
    {
        status_header( 204 );
        return '';
    }
    

Leave a Comment