I have a custom structure for browsing content built with hook_menu
and Views. I would like links to content to be routed by node type to the appropriate destination in my structure. So while normally clicking on a node link takes you to node/123
, I instead would like to be sent to foo/123
(because node 123 is of type 'foo').
I tried PathAuto but it doesn't work to just make foo/123
an alias of node/123
. Specific structure, tabs, etc... has been built using hook_menu
for foo/123
. PathAuto (as I understand it) is really just displaying node/123
which is just stock drupal node display, and not what I want to be shown.
I started putting together hook_nodeapi
and drupal_goto
to redirect based on node type.
[Working out some infinite redirect issues, but I'm sure I can figure it out.] But do I really want to do this? Won't there be a speed hit to have every link on the site pass through an HTTP redirect?
What's the best way to do this?
Edit
Actually I think the problem is that PathAuto isn't respecting my hook_menu, and possibly not the right tool for the job.
With no PathAuto set up yet, I have a hook_menu that defines a page for foo/123
where foo is the node type. Navigating to foo/###
works as expected displaying my custom version of node ###.
Now I want to redirect node/###
to foo/###
, or put another way, I want all links to node/###
to be written as foo/###
. This seems like an obvious task for PathAuto where under the node type Foo my pattern is foo/[nid]
. Except after setting it up, my hook_node no longer functions. That's because now foo/###
is being routed to node/###
like I asked it to and what's displayed is the vanilla drupal node display, not my hook_menu.