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.
modules/ redirect/ redirect.api.php, line 7
- Hooks provided by the Redirect module.
||Control access to a redirect.|
||Act on a redirect being redirected.|
||Respond to redirect deletion.|
||Respond to creation of a new redirect.|
||Act on redirects being loaded from the database.|
||Alter the list of redirects matching a certain source.|
||Act on a redirect object about to be shown on the add/edit form.|
||Act on a redirect being inserted or updated.|
||Respond to updates to a redirect.|
||Perform redirect validation before a redirect is created or updated.|