Been trying to figure out the best way to do this, but could use some pointers in the right direction.

I've setup my drupal site. Created blocks, pages, custom content types etc. I wanted to find out how it's possible to block access to the default drupal url's like /node/1, /user/2, etc. To give a small example. I created a seperate content type that holds nodes that are shown in the header of each page in a views-block. They actually only hold images. But the user can enter the direct url to that node and view it like it is a normal article? How to block this?

Thanks in advance,

Ben

Comments

agarwal.sudhanshu’s picture

I think you can redirect users to page not found URL based on the node type, you can do this from
- custom module using hook_nodeapi
- template.php in theme folder from page preprocess function

Thanks
Sudhanshu Agarwal

ThaGizmo’s picture

Tnx for the reply. Helped me get a few steps further. Found this http://drupal.org/node/500296 which is something that sounds ok to me. Disable direct access for specific parts of the url and redirecting to a custom 404 page. Meaning the only way pages can be accessed is if they have an alias set.

I didn't get it working flawlesly yet, but should be ok.

Cheers, Ben

tiknajobmak’s picture

There is a module which can help you out.Please have a look here https://www.drupal.org/project/restrict_node_page_view .

Regards
Ankit Kamboj