Prevent Google from indexing images

Home Forums BulletProof Security Pro Prevent Google from indexing images

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #33385
    AW
    Participant

    Hello BPS,

    The new website that i build is purely for data storage(images esp)
    I do not need any caching plugins which i used in other website.
    The question is, is there a method to block google or etc or others from indexed my media library?
    Cos all images are important to clients and shall not go viral.
    Looking forward for your reply.
    Regards,
    Alex

    #33386
    AITpro Admin
    Keymaster

    You would either need to edit your existing robots.txt file or create a WordPress Virtual robots function:  https://forum.ait-pro.com/forums/topic/wordpress-robots-txt-wordpress-virtual-robots-txt/ You would add the code shown in this Google post: https://support.google.com/webmasters/answer/35308?hl=en in your robots.txt file or your WordPress Virtual robots function.

    #33387
    AW
    Participant

    Just did some reading,
    Shall the robots.txt solve the case?
    Code as below:-

    User-agent: *
    Disallow: /wp-content/uploads

    Another new thing i encounter, the JTC Anti-Spam is not working on my new site.
    I am using Restrict Content Pro and i did do some coding that divert http://yourdomain.com/wp-admin to a login page i created. Would it because of the redirection coding made the JTC not working? Below is the redirection code for your reference.

    // add custom redirect logout url page
    /**
    * Sets the custom cookie with the redirect URL
    */
    function wh_set_logout_url_cookie() {
    if( !is_user_logged_in() ) return false;
    global $current_user;
    //getting current user role
    $user_roles = $current_user->roles;
    $user_role = array_shift($user_roles);
    $exists = $_COOKIE['the_logout_url'];
    if( empty( $exists ) ) {
    switch ($user_role) {
    case 'administrator':
    $expire = time() + ( 86400 * 7);
    @setcookie('the_logout_url', 'http://info.awsolutions.website/', $expire);
    break;
    case 'contributor':
    $expire = time() + ( 86400 * 7);
    @setcookie('the_logout_url', 'http://info.awsolutions.website/', $expire);
    break;
    default:
    break;
    }
    }
    }
    add_action( 'init', 'wh_set_logout_url_cookie');
    
    /**
    * Applies the URL saved in the cookie to the wp_logout_url for redirect
    */
    function wh_logout_redirect_url( $logouturl ) {
    
    $redirect = $_COOKIE['the_logout_url'];
    
    if( $redirect ) //redirect to the custom set url
    return $logouturl . '&redirect_to=' . urlencode( $redirect );
    
    //redirect to homepage
    return $logouturl . '&redirect_to=' . urlencode( get_option( 'siteurl' ) );
    
    }
    add_filter('logout_url', 'wh_logout_redirect_url', 10, 2);

    Thanks for the noindex information ! I know how to do now.
    The above, i left out this function that i should send to u.
    Itrs redirect wp-admin to a page with Restriction Content Pro’s shortcode
    the code as below

    // Login redirect to custom page according to post ID// Login redirect to custom page according to post IDif(!function_exists('sekaiju_login_page')):/** * Change Default Login Url Regurned by wp_login_url() * @param string $login_url * @param string $redirect * @return string */add_filter( 'login_url', 'custom_login_url', 10, 2 );function custom_login_url( $login_url, $redirect ) {    $postID = 2654;//get_option('custom_login'); $redirect_to = ''; if($redirect != "") $redirect_to = '?redirect_to='.$redirect; return get_permalink($postID) . $redirect_to;}endif;

    looking forward for your reply on the NoIndex for All Media Folder and the JTC, thanks.
    Regards,
    Alex

    #33389
    AITpro Admin
    Keymaster

    Create a Google Webmaster Tools account if you do not already have one to test your robots.txt file/code using the Robots.txt Tester Tool to see if it is working on your website.

    JTC Anti-Spam|Anti-Hacker uses standard WordPress Hooks – Actions and Filters to load and display the CAPTCHA form fields.  So if your custom Login page does not contain any standard WordPress Hooks then JTC will not display the CAPTCHA form fields because you have not added any standard WordPress Hooks in your custom Login page code.  JTC uses this standard WordPress Login Hook:  login_form to hook into the standard WordPress Login page/form to display the CAPTCHA form fields.  You would need to add the standard WP Login Hook in your custom Login page code.  For examples of how to do that open the standard WordPress wp-login.php file and look for this Action below in the standard WP Login page form code.

    /**
    * Fires following the 'Password' field in the login form.
    *
    * @since 2.1.0
    */
    do_action( 'login_form' );
    #33391
    AW
    Participant

    Hi BPS,
    Okay, I manage to go to wp-login.php
    Saw the hook as

    /**
    * Fires following the 'Password' field in the login form.
    *
    * @since 2.1.0
    */
    do_action( 'login_form' );

    Then I am doubt on what to do next.
    Is it i have to add the ” do_action( ‘login_form’ ); ” into the custom redirect function login form ?
    Which is the one below:-

    // Login redirect to custom page according to post ID// Login redirect to custom page according to post IDif(!function_exists('sekaiju_login_page')):/** * Change Default Login Url Regurned by wp_login_url() * @param string $login_url * @param string $redirect * @return string */add_filter( 'login_url', 'custom_login_url', 10, 2 );function custom_login_url( $login_url, $redirect ) { $postID = 2654;//get_option('custom_login'); $redirect_to = ''; if($redirect != "") $redirect_to = '?redirect_to='.$redirect; return get_permalink($postID) . $redirect_to;}endif;

    If yes, then can guide me on how to add the hook in it ?
    Looking forward for your reply.
    Regards,
    Alex

    #33392
    AITpro Admin
    Keymaster

    Unfortunately, we cannot help you with creating a custom Login page/code, etc.  That is beyond the scope of the BPS Pro technical support that we offer. 😉  So if you cannot figure out how to create a custom Login page then maybe look for WordPress plugins that already do what you want to do instead of creating something new.

    #33393
    AW
    Participant

    Hello BPS,

    Thanks for your advise on the JTC matters and coding.
    Took your advise and back to basic. Website running superb in a simplified way.
    I know its not related to BPS question below, just need your advise if you are available and appreciate it !
    In addition, i generated a robot to prevent indexing which may need your advice on it.

    User-agent: Googlebot-Image
    Disallow: /
    Disallow: /members/
    Disallow: /groups/
    Disallow: /wp-login.php/
    Disallow: /activity/p/

    Is it good above the robots.txt?

    Second, the Virtual Sitemap link that you send in the previous chat, I copy and paste-change the domain to my domain. Paste it into my Child Theme, it shows error 500 and i have to remove it from File Manager.

    I can create a sitemap.xml via GWebCrawer, as below: I wonder is the settings in below is correct to avoid any possible indexing on media, other than Main page only?

    [sitemap info removed]

    Thanks man, hope to hear from you. If it is not possible for you to advise, its okay and truly understand.

    Regards,
    Alex

    #33395
    AITpro Admin
    Keymaster

    Your robots.txt code is valid.  Just install a sitemap plugin like the WordPress Google XML Sitemaps plugin to create sitemaps.

    #33410
    AW
    Participant

    Hi BPS,

    Thanks for your advise !
    Awesome support and security plugins.
    Regards,

    Alex

    #33411
    AW
    Participant

    Hellp BPS,
    I found out that anyone can view and download my media uploaded photos IF they knew the filename.
    Example
    yourdomain.com/wp-content/uploads/2017/06/they-know-the-file-name.jpg
    Is there a way to block this ?
    Looking forward for your reply.

    To be more precise;-
    Non-login user , if they knew the link and file name, they can view and download ( No, No, need to block )
    IF login user with certain access to wp-dashboard ( Can Download, Yes i need this and at the time being all is working )
    Note:- folders viewing is working and block at the time being, example “yourdomain.com/wp-content/uploads/2017/06/

    Thanks.
    Regards,
    Alex

    #33414
    AITpro Admin
    Keymaster

    The only method that I am aware of to protect publicly or privately displayed image files is by using a watermark.  There are several WordPress image watermark plugins available.

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.