URL Paths and Redirects

To change the URL path of your content expand the URL alias section of the right sidebar while editing.

Automatically generating the URL

When you click the arrow to open these settings you will notice two fields. The first is a checkbox that, as a default, is checked. Leaving the box checked will automatically generate the URL based on the Title field of the content.

The Drupal editing interface section for setting the URL alias of the content, showing the checkbox to determine whether to base the URL on the menu and title or to use a custom URL.

If your page has a Title of “testing the title of the page”, this will result in a URL that is: https://www.middlebury.edu/school/testing-title-page.

The system will take your title and automatically generate a URL, removing any stop words: a, an, as, at, before, but, by, for, from, is, in, into, like, of, off, on, onto, per, since, than, the, this, that, to, up, via, and with. The system also adds a hyphen between each word.

You will also notice that the URL is created at the “root” of the website. That is, at /institute/ for the Middlebury Institute site, or /schools-abroad/ for the Middlebury Schools Abroad site. This is because we did not also add the page to a menu through the Menu Settings dialog, which is optional.

If you were trying to add a page to an existing section of the website, this would be a problem. To solve this, we can do two things:

  1. We can go back to our Menu Settings dialog and configure the setting to add the page to a menu and hit save. If “Generate automatic URL alias” is left checked, then the URL will be updated automatically, correcting the URL. As an example, if I edit my Menu Settings and add the page to the Admissions menu, then the URL would update to be: https://www.middlebury.edu/school/admissions/testing-title-page.
  2. Alternatively, I may not want the page to appear in the menu, but I do want the URL to be in a particular section and I want the menu for the page to appear. In that case, I would need to manually create a URL alias.

Manually creating the URL

To manually create a “friendly URL” or what we call a URL alias, you first must uncheck the checkbox we’ve been discussing and then manually type in a new URL. Anything you type will appear after /school/ when the URL is created.

The Drupal editing interface section for setting the URL alias of the content, showing the checkbox to determine whether to base the URL on the menu and title or to use a custom URL.

If you typed in “/heres-an-example-page” the resulting URL would be https://www.middlebury.edu/school/heres-example-page.

If you typed in “/admissions/heres-an-example-page” the resulting URL would be https://www.middlebury.edu/school/admissions/heres-example-page.

It is important to note that the menu for admissions would automatically appear on the page in the second example, even if we did not touch the Menu Settings. That is because the menu is assigned to the URL path. In this case, the Admissions menu appears for any page under “/school/admissions/”. When you manually create page URLs with admissions in them, you will see the menu on those pages.

If you uncheck the box and also do not fill on a URL alias, your URL will not be a “friendly” URL, but instead will reference the Drupal node ID of the page, such as https://www.middlebury.edu/school/node/1234.

URL redirects

When you change the URL of your page, you should consider whether people will try to access the old URL. In order to prevent “broken pages” or 404 errors, the system will automatically generate a redirect from your old URL to the new URL.

Print Article

Details

Article ID: 256
Created
Tue 2/22/22 3:30 PM
Modified
Wed 9/20/23 4:42 PM