I use the module pathauto for SEO-friendly path. So in general the user do not see e.g. mydomain.de/node/8. But if the user type it by himself in the browser address he can see the change to alias in the browser address. How can I achieve that the user get the information "The requested page could not be found." or something else if he type e.g. /node/1, but NOT the information of alias or not existing node?

I tried to find a module. But there is no ready one. And I wondered using a block (see image) is not working. I do not know why, but this would solve my problem.enter image description here

  • Why are you trying to hide that path? There aren’t any technical or SEO reasons I can think of. I think it will be quite difficult to achieve what you’re asking
    – Clive
    May 23, 2018 at 7:13
  • It is not only me looking for a solution. For former drupal versions I find this one drupal.stackexchange.com/questions/1116/…. But it is not fitting for drupal 8
    – lesley n.
    May 23, 2018 at 7:28
  • 2
    This might be a duplicate, see drupal.stackexchange.com/questions/244257/…, depends on the conditions you want to block, you can't simply block all access to /node/id, then the site doesn't work anymore.
    – 4uk4
    May 23, 2018 at 7:35
  • That is not the solution I am looking for, because it is only for role anonymus, depending on type and not in general. But the direction of this solution is good
    – lesley n.
    May 23, 2018 at 7:52
  • @lesleyn that post is for a completely different thing - removing the /node page. You’re talking about removing the /node/123 page, but only when it’s accessed via a specific URL. That’s a very different problem and can’t be solved with access hooks. /node/123 and /alias-for-node-123 are the same entity. If one URL serves a 403/404, so does the other
    – Clive
    May 23, 2018 at 9:25


Your Answer

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

Browse other questions tagged or ask your own question.