Redirect a node to it's custom view I've created a view "myview" for a custom content-type. 

Now I want: Any node of that content-type to be automatically redirected to that view page. 

For example, if a user types: http://my-drupal-site/node/4 and that node is of my desired content-type, it needs to be redirected to http://my-drupal-site/myview/4

What I can do:

What I can do now is writing in my theme's template_preprocess_node() function following lines:

function myCustomTheme_preprocess_node(&amp;$variables) {
    $arg1 = (int) arg(1);
    $isArg1Int = (is_int($arg1) &amp;&amp; $arg1) ? (true) : (false);

    if (isset($variables['node']-&gt;type) &amp;&amp; $isArg1Int) {
        if ($variables['node']-&gt;type == "MY-DESIRED-CONTENT-TYPE") {
            // REDIRECT!
            drupal_goto('myview/' . $variables['node']-&gt;nid);
        }
    }
}


That's pure hard-code, and I don't like it. Is there some elegant solution, may be using URL aliases or something like that?
You can use Panels like Patrick suggests, but Panels requires a lot of resources and it's a bit of a waste to only use it for this simple case.

There are different approaches to this, one could be to react to the full view of the node:

/**
 * Implements hook_node_view().
 */
function hook_node_view($node, $view_mode, $langcode) {
  if ($node-&gt;type == 'type' &amp;&amp; $view_mode == 'full' &amp;&amp; arg(0) == 'node') {
    drupal_goto('url/' . $node-&gt;nid);
  }
}


The if statement if true if the node is of the correct type, is being view in full view and the url is node/..., which should limit to node being view the standard way.

Another way of doing this, would be to use the redirect module or something similar to setup redirects for all nodes of the type to the view. A weakness to this approach could be path alias. But that way you would make a permanent redirect which is more SEO friendly.