7

I want to disable the default front page, that is showing a list of nodes. I use another front page but it is still displayed at the url example.com/node. Either restricting access or redirecting to the front page would be fine.

My homepage is currently set to /home (which gets nicely rewritten to example.com/). Now I have already tried a few different things.

  • Under /admin/config/search/path, I have set an alias from node to home.
    Unfortunately this just resulted in redirecting both example.com and example.com/node to example.com/home, showing the node list - not my front page.
  • I tried with an alias from node to <front> (I don't know if that is even valid there). This almost worked, /home and /node both redirect to example.com showing the right page. But now the node list is available at /<front> ...
  • I also tried with panels, creating a variant of node template. Returning a status code when the path was equals node did not work, I guess because the page is only triggered on /node/, with a slash. It won't let me create a panel just for the node path as the path is already in use of course.
  • There doesn't seem to be any permission for setting access to this list.

So, how can I disable the page at example.com/node?
I guess my problem is I don't even know what kind of page this node list is. I have the feeling it's some unique page type, buried deep down in the core and can't be easily disabled.

3 Answers 3

10

If you're ok with writing a small custom module you could do it very easily using hook_menu_alter():

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

The above will deny access to the page, if you want to remove it completely use this instead:

function MYMODULE_menu_alter(&$items) {
  unset($items['node']);
}

There's a discussion on the subject here with a few other ideas but I think this would be the simplest.

2

You can install Node Page Disable contrib module from Drupal.org.
And then just uncheck "Retain /node as an active url?" on page Configuration > System > Site information (/admin/config/system/site-information) Node Page Disable screenshot

1

I just set up an alias from home (system path) to node (alias) and it is working now. This is the opposite of what I've tried before. Both paths end up on example.com and show the correct new front page.

Anyway, this is probably just 'hiding' the system node at this url, so removing/denying access might be the better way to handle this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.