URL Redirects
A URL redirect allows you to redirect one URL path to another.
The URL you are redirecting must not be used as an alias on the site. In other words, the path must not be assigned to an existing page.
Automatic redirects
Stanford Sites makes certain redirects automatically. For example, if you had an"About" page with the path /our-team
, and moved the page to a new location under the "About" page, the new page alias would be /about/our-team
. A new redirect would be created automatically so that anyone visiting /about
would be directed to /about/our-team.
Managing URL redirects
A full listing of your site's URL redirects can be found on the Redirect admin page at [your site URL]/admin/config/search/redirect
or navigate to Configuration > Search and metadata > URL redirects. From this page, you can add new redirects, edit or delete current redirects, and filter your redirects.
Adding a new URL redirect
- If you are within the Redirect admin page, click Add redirect. Otherwise, hover over Configuration > Search and metadata > URL redirects > Add redirect in the admin toolbar.
- Enter the source path in the Path field.
- Enter the destination path in the To field. The destination can be an internal path if it's on your site, or a full external URL if you want to redirect to an external website.
- Almost all the time, you will want to leave Redirect status set to "301 Moved Permanently".
- Click Save.
You can learn more about HTTP redirect status codes at https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection
Manage the URL redirects on an individual page
You can also manage the URL redirect for an individual page on the edit form. Click the URL redirects tab in the sidebar. From this screen, you can add new URL redirects, or edit/delete existing redirects.
Troubleshooting
If you get a message like "The source path [path] is likely a valid path" you are trying to redirect an existing page. You cannot redirect an existing page even if it is unpublished. To get a redirect in place, change the URL alias (path) of the page to something new. When you have done so, a new redirect will be created that leads users from the old path to the new one. You can now edit this redirect to go elsewhere. Note: you should not redirect the backend URL (like /node/[number]
.)