function drupal_goto


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 drupal_goto($path = '', array $options = array(), $http_response_code = 302)
cle7 drupal_goto($path = '', array $options = array(), $http_response_code = 302)
elmsmedia7 drupal_goto($path = '', array $options = array(), $http_response_code = 302)
icor7 drupal_goto($path = '', array $options = array(), $http_response_code = 302)
meedjum_blog7 drupal_goto($path = '', array $options = array(), $http_response_code = 302)
mooc7 drupal_goto($path = '', array $options = array(), $http_response_code = 302)

Sends the user to a different page.

This issues an on-site HTTP redirect. The function makes sure the redirected URL is formatted correctly.

Usually the redirected URL is constructed from this function's input parameters. However you may override that behavior by setting a destination in either the $_REQUEST-array (i.e. by using the query string of an URI) This is used to direct the user back to the proper page after completing a form. For example, after editing a post on the 'admin/content'-page or after having logged on using the 'user login'-block in a sidebar. The function drupal_get_destination() can be used to help set the destination URL.

Drupal will ensure that messages set by drupal_set_message() and other session data are written to the database before the user is redirected.

This function ends the request; use it instead of a return in your menu callback.


$path: (optional) A Drupal path or a full URL, which will be passed to url() to compute the redirect for the URL.

$options: (optional) An associative array of additional URL options to pass to url().

$http_response_code: (optional) The HTTP status code to use for the redirection, defaults to 302. The valid values for 3xx redirection status codes are defined in RFC 2616 and the draft for the new HTTP status codes:

  • 301: Moved Permanently (the recommended value for most redirects).
  • 302: Found (default in Drupal and PHP, sometimes used for spamming search engines).
  • 303: See Other.
  • 304: Not Modified.
  • 305: Use Proxy.
  • 307: Temporary Redirect.

See also



Related topics

146 calls to drupal_goto()
addanother_goto in sites/all/modules/ulmus/addanother/addanother.module
Takes the user to the node creation page for the type of a given node.
admin_menu_flush_cache in sites/all/modules/ulmus/admin_menu/
Flush all caches or a specific one.
admin_menu_toggle_modules in sites/all/modules/ulmus/admin_menu/
Menu callback; Enable/disable developer modules.
aggregator_admin_refresh_feed in modules/aggregator/
Page callback: Refreshes a feed, then redirects to the overview page.
analytics_dashboard_form_submit in sites/all/modules/local_contrib/google_chart_tools/analytics_dashboard/
Submit handler for analytics_dashboard_form()

... See full list

6 string references to 'drupal_goto'
batch_process in includes/
Processes the batch.
common_test_menu in modules/simpletest/tests/common_test.module
Implements hook_menu().
ctools_export_ui::redirect in sites/all/modules/ulmus/ctools/plugins/export_ui/ctools_export_ui.class.php
Perform a drupal_goto() to the location provided by the plugin for the operation.
ctools_wizard_multistep_form in sites/all/modules/ulmus/ctools/includes/
Display a multi-step form.
drupal_redirect_form in includes/
Redirects the user to a URL after a form has been processed.

... See full list


includes/, line 686
Common functions that many Drupal modules will need to reference.


function drupal_goto($path = '', array $options = array(), $http_response_code = 302) {
  // A destination in $_GET always overrides the function arguments.
  // We do not allow absolute URLs to be passed via $_GET, as this can be an attack vector.
  if (isset($_GET['destination']) && !url_is_external($_GET['destination'])) {
    $destination = drupal_parse_url($_GET['destination']);
    $path = $destination['path'];
    $options['query'] = $destination['query'];
    $options['fragment'] = $destination['fragment'];

  drupal_alter('drupal_goto', $path, $options, $http_response_code);

  // The 'Location' HTTP header must be absolute.
  $options['absolute'] = TRUE;

  $url = url($path, $options);

  header('Location: ' . $url, TRUE, $http_response_code);

  // The "Location" header sends a redirect status code to the HTTP daemon. In
  // some cases this can be wrong, so we make sure none of the code below the
  // drupal_goto() call gets executed upon redirection.



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.