By jdevries on
I'm not even sure if it's possible, but basically what I would like to do is only allow the alias of a Drupal url like "node/123" to display the page. The reason for that is mostly privacy related: I use pathauto to generate urls that combine the node ID and an uploaded filename. The two combined would be sufficient privacy for my cause, but I don't really want anybody being able to access the node by simply typing in node followed by a random node ID.
Is it possible, and if so, where should I start looking to make this happen? Thanks.
Comments
Global Redirect Module
http://drupal.org/project/globalredirect
I have in fact tried the
I have in fact tried the module, but while it does redirect to the alias, it still allows you to access a node by typing "node/123". I really just want only the alias to be accessible instead, not the "node/123" url.
Any takers? It is kind of
Any takers? It is kind of important to me, so any help would be much appreciated. Thanks!
.htacces and "RewriteRule"
You should try with .htacces and "RewriteRule". Try something like this:
RewriteRule ^node/([0-9]+)/$ /frontpage [L,R=301]
RewriteRule ^node/([0-9]+)$ /frontpage [L,R=301]
RewriteRule ^node/$ /frontpage [L,R=301]
RewriteRule ^node$ /frontpage [L,R=301]
I believe that is not 100% correct but works for me. "/frontpage is page to redirect from "node/***". Node is accessible only through url alias. There is only one catch, edit or track link could be also redirected. Maybe someone with more expirience and knowledge could write correct .htaccess solution.