Disabling / node view and other hidden views in Drupal?

Many long nights spent on my site, and now I started doing all kinds of security checks and came across the following:

www.mysite.com/node

This shows the last x nodes that the user has access to. I do NOT want this view to be visible to users. And I certainly do not want any other views like this to be available. So my questions are:

  • How to disable this view?
  • Are there other hidden views that I don’t know that an anonymous user can use to access multiple sites at once?
+3
source share
5 answers

hook_menu_alter() , , , - /node. .

-, :

function custom_module_menu_alter(&$items) {
  $items['node']['access callback'] = FALSE;
}

-, :

function custom_module_menu_alter(&$items) {
  $items['node']['page callback'] = 'custom_module_new_page_content';
}
function custom_module_new_page_content() {
  return 'Go away!';
}

, , , .

, , .

, Tracker . Contrib, , Tracker, Views.

EDIT: - Tracker "" . , , .

+5

, , hook_menu_alter .

"" , , , "" ( , ). , , menu_router Drupal. , ( , , ).

+3

, , - Path module /node - , /node/1 - .

Not sure about the other urls you get that you don’t want to see ... I would think this method would work for anyone you come across

+2
source
function modulename_menu_alter(&$items) {
    $items['node']['page callback'] = 'drupal_not_found';
}

Source: http://drupal.org/node/500296#comment-3532630

+1
source

The "node" view is the default homepage view. So this is usually the same as you are on the first page.

-1
source

Source: https://habr.com/ru/post/1719196/


All Articles