How to... Handle URL Redirects

Body

Over time, your website is going to change. Pages will be renamed or removed. Your navigation will change to ease the discovery of information. However, this can create issues if old links exist anywhere on your site, on Google, or in your visitor's bookmarks list (among other things). Redirects point from one URL to another. This ensures that, when an old URL is visited, the visitor's session is redirected to the content's new location, or somewhere similar. This can be accomplished in a number of ways. Some of them are handled for you by SiteMasonry, while others may take some setup.

Where Redirects are Automatic

Most changes you make that cause a URL to change in SiteMasonry will automatically create redirects, thanks to the automatic changes built into the platform.

A screenshot of the URL Alias screen, that reads "URL Alias (Automatic alias) [Checkbox] Generate automatic URL alias. Unscheck this to create a custom alias below. Configure URL alias patterns. [Space] URL Alias: Specify an alternative path by which this data can be accessed. For example, type "/about" when writing an about page."

You may have noticed a part of the sidebar on any article or page's "Edit Settings" page labeled "URL Alias." This controls what the URL of any given page is. By default, "generate automatic URL alias" is checked, meaning that SiteMasonry will use a combination of your site navigation and page name to determine the URL of the page.

This is important to note because this means any time you rename a page, it is automatically creating a new URL for the page. The automatic URL function will handle the redirect for you, generating an entry that you can see and edit under Configuration > Search and Metadata > URL redirects.

Self-Updating Links

Screenshot of the SiteMasonry link interface. A text field is labeled URL. "Content Hub" has been typed into the search bar, and a variety of page names with "content hub" in them are displaying in the results.

Knowing these automatic updates exist is important, especially when handling links in your site. In several places, SiteMasonry will allow you to find and link to a page using it's page name rather than a straight URL. This is always advised because it more easily follows redirects over time. Using a URL creates more room for error and a user finding a "page not found" message instead of your content.

Where Redirects Require Your Help

Sometimes a redirect is needed but the automatic system either can't help or actively causes a redirect where you don't want one. This happens in situations such as moving a URL from one page to another, or wanting content from a deleted page to go to a new location.

First, it is very important to know your two URLs: the old one and the new one. Once you have those, evaluate what sort of redirect this is: are you permanently removing a page and redirecting all links to is to a related page? Are you remaking the same page and looking to swap the URL to the new page, retiring the old one? While these have very similar methods of completion, their execution requires very different steps.

Redirecting from One URL to Another

The process of setting up a redirect manually is very easy to do. To start, go to the back end of your website. You want to look for Configuration > Search and Metadata > URL redirects. From there, click Add Redirect to open a new redirect instance.

A screenshot of the user interface of the back end of Site Masonry. The configuration dropdown is expanded to show where URL aliases is placed.

This is where you will be putting in your two URLs. For the first, leave off the start of the URL, placing only the internal path in the field. For the second, you have more options. You can use a full URL or an internal path, or you can search for a piece of content, such as a page name.

Screenshot of the URL Redirect addition screen, where there are fields for "from" url, "to" url, and the redirect status code.
You can place an external URL into the second field to redirect somewhere off the site. However, if you wish to do the reverse (linking from an external site to this one) you will need to set up the redirect in domain redirects. If you need assistance with this, please contact our team and/or ITS to help you start the process.

Redirect status is a piece of information that helps tell Google’s indexing bots about the redirect. By default, this is set to “301 Moved Permanently”. This tells Google it can update its listings for the page to permanently indicate the corrected location. The other most common one is “307 Temporary Redirect” which tells Google the redirect is only for a short time. This might be because a page is under construction and you need the redirect to be removed later. Choose the option you need, then save.

Moving a URL between Pages

Sometimes when making pages, you want to move a URL from one page to another. However, the process of making a new page with the same name will auto-generate a URL that has a 0 or similar at the end. To keep all your URLs looking tidy and ensure no links break, you’ll need to not only change the names of the pages but edit some URL redirects to ensure the traffic goes where it should.

To fix this, follow these steps in order.

  1. Change the URL of the old page. You need to do this first to make the URL available. To make this happen, go to the old page’s settings and check the URL Alias field. If generate automatic URL alias is checked, uncheck it. Then change the information after the "/" of the URL to set up your new URL. If you are unsure what to put, the page title followed by "archived" is often a good option.
  2. Delete the automatic redirect that just created. Changing a URL automatically creates a redirect. However, for this situation, we don't want the redirect to happen. Navigate to the URL Redirects list and delete the redirect you just created. You can find the redirect by searching for the "from" or "to" URL.
  3. Change the URL of the new page. With the URL you wanted now made available, we can now use it on our new page.
    • If you are looking at a URL that has a -0 at the end of what you want it to be, uncheck and recheck the "Generate automatic URL alias" field on the page’s settings. Save and check the page’s URL. It should be set up now!
    • If you were using a placeholder page title, change the title to the correct new title. Save and check the page's URL to confirm the change has happened. If it didn't update, uncheck and recheck the "Generate automatic URL alias" field on the page’s settings, then save again.

 

This may feel like a lot to do to keep your site organized, but it is crucial work. Without redirects, links would break far more regularly, causing 404 errors and very frustrated site visitors! Of course, if you ever need assistance, please contact the SiteMasonry team and we'll be happy to lend you a hand.