D
D
Dmitry Klimantovich2020-10-15 09:59:26
Search Engine Optimization
Dmitry Klimantovich, 2020-10-15 09:59:26

How to restrict access to the /uploads/ page in wordpress and should it be opened for indexing in Robots.txt?

My page /uploads/ is indexed by Yandex and is defined as poor quality.
Well, here I agree that it is of poor quality: The uploads page .
I wanted to limit it like this:

function true_block_admin_pages_error() {
  global $pagenow;
  $pages_to_block = array(
    'page.php'
  );
  if(in_array($pagenow, $pages_to_block)){
    // внутри скобок, в кавычках, указываем своё сообщение, HTML поддерживается
    wp_die('Прости, доступ к этой странице для тебя закрыт. <a href="' .home_url(). '">Вернуться в админку.</a>');
    exit;
  }
}
 
add_action('admin_init', 'true_block_admin_pages_error')

But the page does not have its own file.
Then how to limit? plugins do not want to install because of one page.

And in general, is it worth it to open the page to search engines in robots.txt?
Allow: */uploads # открываем uploads

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Puma Thailand, 2020-10-15
@dikey58

and what for to open a listing of directories is a direct way to get hacked like a sucker , close it
in the Apache config
Options -Indexes

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question