Note that there are some explanatory texts on larger screens.

plurals
  1. PORedirecting or rewriting drupal links
    primarykey
    data
    text
    <p>I have a custom structure for browsing content built with <code>hook_menu</code> 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 <code>node/123</code>, I instead would like to be sent to <code>foo/123</code> (because node 123 is of type 'foo').</p> <p>I tried PathAuto but it doesn't work to just make <code>foo/123</code> an alias of <code>node/123</code>. Specific structure, tabs, etc... has been built using <code>hook_menu</code> for <code>foo/123</code>. PathAuto (as I understand it) is really just displaying <code>node/123</code> which is just stock drupal node display, and not what I want to be shown.</p> <p>I started putting together <code>hook_nodeapi</code> and <code>drupal_goto</code> 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?</p> <p>What's the best way to do this?</p> <p><strong>Edit</strong><br> 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 <code>foo/123</code> where foo is the node type. Navigating to <code>foo/###</code> works as expected displaying my custom version of node ###.</p> <p>Now I want to redirect <code>node/###</code> to <code>foo/###</code>, or put another way, I want all links to <code>node/###</code> to be written as <code>foo/###</code>. This seems like an obvious task for PathAuto where under the node type Foo my pattern is <code>foo/[nid]</code>. Except after setting it up, my hook_node no longer functions. That's because now <code>foo/###</code> is being routed to <code>node/###</code> like I asked it to and what's displayed is the vanilla drupal node display, not my hook_menu.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload