WordPress.org

Ready to get started?Download WordPress

Forums

How do I keep search engines from searching a pdf? (2 posts)

  1. Jose
    Member
    Posted 1 year ago #

    Don't know how to really word this but - I have built a site in WordPress and set up user logins for members only, using plugin peters-login-redirect. So anyone with that username and password and view the page once they logged in. Others will just simply have to continue viewing the site. So I got that working and all but the client has entered information like PDFs for users to view on that page and this client was searching on the web the names that a PDF contains and that it should not be accessible to the public but only for those who are logged in. Is there any way I can set that PDF in private that is not searched by search engines. And if i can set it up where not just no one with the link can view it, only those who are logged in.

  2. MickeyRoush
    Member
    Posted 12 months ago #

    You can do this with .htaccess

    # BEGIN file lock-downs
    RewriteCond %{HTTP_COOKIE} !wordpress_logged_in
    RewriteRule ^name-of-the-file\.pdf$ http://example.com/not-allowed/ [R=302,L]
    # END file lock-downs

    Where example.com/not-allowed is a page on your site that you send anyone to when they try to access it. Yes, it will work for robots, unless you allow robots to register and log into your site.

Topic Closed

This topic has been closed to new replies.

About this Topic