Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
By chanjay on
Hi,
I would like to redirect 'node/38' to 'node/58'. I use hook_menu() but it only works when logged in as 'user/1'. If I logged off, it always redirects 'node/38' to front page.
Here is my code:
function redirectpage_menu() {
$items = array();
$items['node/38'] = array(
'title' => 'Redirecting page',
'access arguments' => FALSE,
'page callback' => 'redirected_page',
'type' => MENU_CALLBACK,
);
return $items;
}
function redirected_page() {
drupal_goto($path = 'node/58');
}
Any idea?
Thanks.
hc.
Comments
You probably only need to
You probably only need to have an 'access callback' return TRUE in your hook_menu.
Otherwise you could use: hook_url_inbound_alter
Change this:
Change this:
To this:
Thank you. It works! hc.
Thank you. It works!
hc.
No need for your own callback
No need for your own callback function: