Created
June 16, 2017 12:16
-
-
Save bfodeke/1cc514d9f8a2375235102ac80e7192d3 to your computer and use it in GitHub Desktop.
Create a redirect to a path using the redirect module.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Apply redirect from old content to new content. | |
$old_alias = 'some/old/path'; | |
$new_alias = 'node/' . $node->nid; | |
$redirect = new stdClass(); | |
redirect_object_prepare($redirect); | |
$redirect->source = $old_alias; | |
$redirect->redirect = $new_alias; | |
redirect_save($redirect); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment