Redirects may be created by end-users to manually redirect from one URL on the site to another one (or to an external URL). For example the path "about" may be redirected to "pages/about-us" after a site redesign. The old URLs should be redirect to the new ones to maintain search engine rankings, existing links, and bookmarks to the old URL.

Redirects are stored in the database in the "redirect" table. Loading and saving of redirects should be done through the Redirect API to ensure modules responding to the modification of redirects also have an opportunity to make adjustments as needed. The Redirect object is used to wrap around all the operations that can be done on redirects. It is recommended that redirects be loaded using one of the existing functions for loading, or if creating a new redirect, created by instantiating a new Redirect object.

See also

Redirect

redirect_load()

redirect_load_multiple()

redirect_load_by_source()

File

modules/redirect/redirect.api.php, line 7
Hooks provided by the Redirect module.

Functions

Namesort descending Location Description
hook_redirect_access modules/redirect/redirect.api.php Control access to a redirect.
hook_redirect_alter modules/redirect/redirect.api.php Act on a redirect being redirected.
hook_redirect_delete modules/redirect/redirect.api.php Respond to redirect deletion.
hook_redirect_insert modules/redirect/redirect.api.php Respond to creation of a new redirect.
hook_redirect_load modules/redirect/redirect.api.php Act on redirects being loaded from the database.
hook_redirect_load_by_source_alter modules/redirect/redirect.api.php Alter the list of redirects matching a certain source.
hook_redirect_prepare modules/redirect/redirect.api.php Act on a redirect object about to be shown on the add/edit form.
hook_redirect_presave modules/redirect/redirect.api.php Act on a redirect being inserted or updated.
hook_redirect_update modules/redirect/redirect.api.php Respond to updates to a redirect.
hook_redirect_validate modules/redirect/redirect.api.php Perform redirect validation before a redirect is created or updated.