Score:0

Changing a node alias to reuse his old url programmatically without be still redirected to the node page

in flag

I'm on a old site on drupal 7. I have a node with alias /url. Now I need to manage that page url programmatically, so I create an item in a custom module using hook_menu() in this way:

/**
 * Implements hook_menu().
 */
function MYMODULE_menu() {
  $items = [];

  $items['url'] = [
    'title' => 'New Title',
    'page callback' => 'MYMODULE_url_callback',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  ];

  return $items;
}

In the previous node I've changed the alias to /url-old but when I go to the page /url I've been redirected to /url-old and can't reach the new page.

Where is still referenced the relation between node/<nid> and his old alias /url?

I've the module Pathauto installed. In the aliases list the /url link is no more present.

Thanks in advance.

sonfd avatar
in flag
Look for a redirect on the Redirect config screen, */admin/config/search/redirect*. Or Via admin toolbar: Manage > Configuration > Search and metadata > URL redirects. Edit: Woops, these paths are for D8/D9, but the idea is the same.
in flag
Thanks @sonfd! It was not Pathauto but redirects configuration. It resolves :)
Score:0
in flag

I've found where are defined all node's redirects:

Configuration > Search and metadata > URL aliases.

Needs to remove all occurrence for the new url before to reach the page programmatically.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.