Add 'noindex, nofollow' to user/login user/password pages based on url

Public

Add 'noindex, nofollow' to user/login user/password pages based on url. Put this in your theme template.php file in the theme_preprocess_html function.

</> CopyGet raw version
php
  1. $url_parts = explode('/', request_uri());
  2. if ($url_parts[1] == 'user') {
  3. $elements = array(
  4. '#tag' => 'meta',
  5. '#attributes' => array(
  6. 'name' => 'robots',
  7. 'content' => 'noindex,nofollow',
  8. ),
  9. );
  10. drupal_add_html_head($elements, 'robots');
  11. }