The Drupal way of adding HTML syntax within hook_redirect_alter
Since you cannot specify a 301 redirect in javascript, here is what I did all within hook_redirect_alter() :

function mymodule_redirect_alter($redirect) {
  // If checkbox is set then use URL parameter for redirect, otherwise ignore everything
  if (variable_get('my_checkbox', '') == '1') {
    $params = drupal_get_query_parameters();
    $my_parameter = variable_get('my_parameter', '');

    // Append redirect values seperated by commas if the specified parameter exists    
    if (!empty($params[$my_parameter])) {
      $refs = $params[$my_parameter] . ',' . $redirect-&gt;source;
    }
    // Otherwise add souce as the value of the parameter
    else {
      $refs = $redirect-&gt;source;
    }

    // Create parameters to append to URL
    $params = array('query' =&gt; array($my_parameter =&gt; $refs));

    // Do the actual redirect with this new parameter
    drupal_goto($redirect-&gt;redirect, $params);

    // This kills sever-side redirect
    exit();
  }
}


So the URL mysite.com/original_page will be redirected to a page with URL mysite.com/mypage?redirect=original_page