Force the usage of path aliases The title is explaining what I'm trying, my question is: Am I doing it right?

function hook_entity_view($entity, $type) {
    if (arg(0)=='node') {
        drupal_goto($entity-&gt;type.'/'.$entity-&gt;nid);
    }
}


My aliases look like this: article/123


article is the entity type.
123 is the node ID.


When I go to ../node/123 than I get a 503.
Looks like you are creating loop redirection. But that you can test by examining logs. I believe there is an easier way: already implemented Global Redirect module:


  This module uses hook_init to interrupt the page load and action the alias lookups. If any of the above rules apply then the appropriate action is taken. If no rules apply then the page load continues uninterrupted. An example of this in use is on the site it was developed for. http://www.sportbusiness.com/node/160559 will redirect to http://www.sportbusiness.com/news/160559/lagardere-sets-up-sports-division due to the alias setup on this site.