Block Drupal URLs

Is there a module that I can use to disable some Drupal system pages? For example, I would like to disable node , taxonomy/term/* , filter/tips .

+4
source share
2 answers

I'm not sure if there is a module that does this, but it's not too difficult to write your own custom module for this. You only need to implement hook_menu_alter (and clear the cache after changing the code). You can choose to return to the "access denied" or "404 not found" page:

 <?php function MODULENAME_menu_alter(&$items) { // This will deny access to taxonomy/term/* for all users. $items['taxonomy/term/%']['access callback'] = FALSE; // This will completely remove filter/tips, resulting in a 404. unset($items['filter/tips']); } ?> 

If you want to learn more about writing Drupal modules, see http://drupal.org/developing/modules .

+8
source

It seems to me that this is more of a β€œone-time” configuration. So I wonder if he needs to have an admin interface for this, which you requested in one of your comments.

If you use apache, you can include the following directives in the virtual host configuration of your site:

 <LocationMatch ^/taxonomy/term> SetHandler server-status Order Deny,Allow Deny from all </LocationMatch> <LocationMatch ^/filter/tips> SetHandler server-status Order Deny,Allow Deny from all </LocationMatch> 

This will prevent access to these URLs. But you have to make sure that you do not have a URL with an alias before the taxonomy/term/ etc. paths Otherwise, the user may access these URLs.

Check out http://httpd.apache.org/docs/2.0/mod/core.html#locationmatch and http://httpd.apache.org/docs/2.0/mod/core.html#location for some documentation

+6
source

All Articles