How to Bulk Upload Redirects
You can create redirects on your website individually, or you can bulk upload them to your site. This is handy when you are moving your content from one site to another site with a different URL structure. The redirects ensure that users going to an outdated URL end up in the right place.
Create a list of redirects
The format of the redirects list is a CSV file that is formatted with only these columns, in this exact order:
source | destination | language | status code |
---|---|---|---|
To create a new list, you can use your preferred spreadsheet software (e.g., Microsoft Excel, Google Sheets) to fill out these columns and then, when done, export as a CSV (comma-separated values) file format.
Google Docs template (please copy to your own drive)
The following is information about what should be in each column:
- Column A (source): Enter the page path you wish to redirect. It must start with a forward slash. So, if you wish ed to redirect the URL
https://sitesuserguide.stanford.edu/release-notes/requested-features
, you would enter "/release-notes/requested-features." The "From URL" field cannot take a full URL. It must have only path (everything after the main domain.) The path may NOT be a valid path on your site. - Column B (destination): Enter the URL of the new page that you want to redirect to. If this is a page on your site, all that is required is a path. So, if you wanted to redirect your old page path to a new page with the URL "https://sitesuserguide.stanford.edu/whats-new/requested-features," you would enter "/whats-new/requested-features" in Column B. The pathname indicated in column B, if a local path, must exist on your site. You can also enter full URLs in column B if you wish to redirect your user off your site.
- Column C (language): This can be "und" since we do not run multilingual sites.
- Column D (status code): Enter "301" in this column to indicate that you want to perform a permanent redirect (which is typically the most appropriate type of redirect for SEO purposes). If this was a temporary redirect, you would use the type "302."
Your final result should have rows that look like this (example internal redirect and sample external redirect shown):
source | destination | language | status code |
---|---|---|---|
/release-notes/requested-features | /whats-new/requested-features | und | 301 |
/release-notes/new-updates | https://uit.stanford.edu/sws | und | 301 |
Once you have filled out all of the rows in the template, save it to your computer as a CSV file. This will typically involve selecting "Save As" from the "File" menu in your spreadsheet software and selecting "CSV" as the file type. Be sure that you include the file extension. Your filename should look something like this: redirects.csv
.
Upload the redirects list
- Log in to your website's administration area and navigate to the "Configuration" section.
- Hover over "Search and Metadata" in the configuration menu to reveal additional options.
- Hover over "URL redirect" in the sub-menu and click on "Migrate".
Once you are on the Migrate page:
- Click on Choose File to select the completed CSV file from your computer
- Click on Migrate data upload it
- Wait for the import process to complete. Depending on the size of your CSV file and the speed of your website, this may take several minutes.
Once the import process is complete, you can return to the URL redirects page to review the list of imported URL redirects to ensure that they were imported correctly. You may need to manually edit any incorrect or incomplete redirects.
Test your redirects
Test the URL redirects to ensure that they are working correctly by visiting the old URLs and confirming that they redirect to the new URLs as expected. You may wish to wait 5 minutes for caching to clear.
Tip: Use the sitemap to generate a list of URLs for your site
If you're looking at redirects for a whole site, you can find the urls on your site at the sitemap at https://<your-site>/sitemap.xml. For example, the sitemap for this site is https://sitesuserguide.stanford.edu/sitemap.xml
- Copy and paste the URLs into the correct column of the spreadsheet
- Use Find and Replace to remove extraneous hostname, etc.
Troubleshooting
I get an error and it won't take my file
Ensure that all the required fields are filled in before submitting the form. This includes any mandatory fields that are marked with an asterisk (*).
In the "To URL" and "From URL" fields, make sure that you only include the part of the URL that comes after the hostname. For example, if the full URL is "https://www.example.com/page1.html", you would only need to enter "/page1.html" in these fields.
Double-check all the information you have entered before submitting the form to avoid any errors or typos.
If you are still in need of assistance after submitting the form, you can submit a ServiceNow ticket to request further support. Provide as much detail as possible about the issue you are experiencing, including any error messages or screenshots that may be helpful.
I received an error "You are attempting to redirect "<page name>" to itself. Bypassed, as this will result in an infinite loop."
Double check your CSV for duplicate URLs. To make it easier to find, try sorting the urls. Remove the duplicates and verify that the remaining redirects are specified correctly.