Home>

On the site there are links to downloadable files, such as PDF document and Zip archive. Search engines are defined as separate pages and index (for example, "/philes/example.pdf"). Do you need to close them from searching, as well as when?

I have one file on the site (.txt) Yandex deleted from the search as an insignificant page, one more similar while in the search. I'm afraid they will be regarded as NCC, so I'll close them in robots.txt. For the future I want to figure out how it will be more correct to act with different files.

  • Answer # 1

    You better give the file to download. After the page headers, you need to add Readfile ($ File);

    Example, code:

    function file_force_download ($ file) {
      If (File_exists ($ File)) {
        if (ob_get_level ()) {
          OB_END_CLEAN ();
        }
        //Forcing the browser to show the file saving window
        Header ('Content-Description: File Transfer');
        Header ('Content-Type: Application /OCTET-STREAM');
        Header ('Content-Disposition: attachment; filename='. Basename ($ File));
        Header ('Content-Transfer-Encoding: Binary');
        Header ('Expires: 0');
        Header ('Cache-Control: Must-Revalidate');
        Header ('Pragma: Public');
        Header ('Content-Length:'. Filesize ($ File));
        //Read the file and send it to the user
        Readfile ($ File);
        exit;
      }
    }
    
  • Answer # 2

    You better give the file to download. After the page headers, you need to add Readfile ($ File);

    Example, code:

    function file_force_download ($ file) {
      If (File_exists ($ File)) {
        if (ob_get_level ()) {
          OB_END_CLEAN ();
        }
        //Forcing the browser to show the file saving window
        Header ('Content-Description: File Transfer');
        Header ('Content-Type: Application /OCTET-STREAM');
        Header ('Content-Disposition: attachment; filename='. Basename ($ File));
        Header ('Content-Transfer-Encoding: Binary');
        Header ('Expires: 0');
        Header ('Cache-Control: Must-Revalidate');
        Header ('Pragma: Public');
        Header ('Content-Length:'. Filesize ($ File));
        //Read the file and send it to the user
        Readfile ($ File);
        exit;
      }
    }
    
  • Answer # 3

    If you do not want these files to be available (in any way) in the search, it is necessary to hide. Not the fact that bots will be able to analyze these documents and show their contents in the query, but usually hide. And in the page where these files can be read clearly describe these files

  • Answer # 4

    If you do not want these files to be available (in any way) in the search, it is necessary to hide. Not the fact that bots will be able to analyze these documents and show their contents in the query, but usually hide. And in the page where these files can be read clearly describe these files