Something like this might work:
WorkflowManager workflowManager = WorkflowManager.GetInstance(new TreeProvider());
WorkflowInfo workflow = workflowManager.GetNodeWorkflow(node);
// Checks if the page uses workflow
if (workflow != null)
{
if (!node.IsCheckedOut)
{
node.CheckOut();
}
node.DocumentMenuRedirectUrl = url;
node.Update(true);
node.CheckIn();
if (!workflow.WorkflowAutoPublishChanges)
{
node.Publish();
}
}