URLs


Introduction

  • All URLs on your KU CMS site should be strategic and properly formatted
  • Simple and human-readable URLs are valuable for users and search engines (SEO)
  • Poor quality URLs can bring down the overall aesthetic and cleanliness of your site and damage the user experience online and in print

Strategy and Formatting

Like Page Titles and Headers, URLs should be as simple and clear as possible. Poor-quality URLs can make your site feel disorganized and messy creating a sub-par user experience. Additionally, although URLs do not have a major impact on search engine rankings, they can impact your SEO.

Be as strategic with your URLs as you are with your Page Titles and Headers – always create a clear relationship between your Page Title, Headers and URL.

Proper URL Formatting

  • Keep them short and simple – remove all extraneous words
  • Make them easy to type and remember (this is helpful if the URL is ever including in an email or in print)
  • Use hyphens between all words
  • Use URLs that help users understand the site location of the page (e.g., /people/name) and allow them to remove the last part of the URL to arrive at a higher-level site destination.

Do Not Use Absolute URLs for Internal Pages

When creating links on your KU CMS site, be sure to use relative URLs for your internal pages (e.g., /yourpagename or /node/#). Do not use absolute URLs or those links will break automatically when your new site goes live.

What is a relative URL?

  • A relative URL assumes that the page you are linking to is on the site and provides only the specific page path or the node (e.g., “/yourpagename” or “/node/427”).

What is an absolute URL?

  • An absolute URL is when you provide the full path: yoursitename.cms-dev.ku.edu/yourpagename
  • Absolute URLs are necessary for external links, but should be avoided for internal links.

Why are absolute URLs a problem on internal pages?

When a new KU CMS site is launched, the development site [yoursitename.cms-dev.ku.edu] ceases to exist. So, any link on your site that has [yoursitename.cms-dev.ku.edu] will break immediately when the new site goes live.

What’s the best way to create relative URLs?

Drupal makes creating relative URLs easy.

  1. Once a page has been created, you can type the page title in any link field and the page will appear in a dropdown menu. Once you select the page from the dropdown menu, Drupal puts in the relative path for you.
  2. If you know the specific path (e.g., /yourpagename) or node number (e.g., /node/427) for your page, you can type either of those in manually.

Relative Paths – URLs to Files Cannot Have Spaces

If a relative URL to a file is not working, it is likely caused by spaces in the name of the file you are linking to.

Relative paths cannot include spaces in the file name or the folder name - a common error in file and folder naming. URLs with spaces render with %20 in place of the space. When a relative path includes spaces, the %20 symbol gets re-coded as %2520, which breaks the link.

The fix the issue, simply rename your file with underscores, dashes or camel case in place of the spaces.

Migrate the Same URLs or Create a Redirect

When you are migrating pages, be sure to use the same URL whenever possible. Keeping the same URL will ensure that those links do not break on other sites, bookmarks, or in print documents.

If you do need to change the URL, just remember to create a redirect on your new site. A redirect will allow you to change the URL and ensure that users find the correct page on your new site.

Common URL Errors

Redundant URLs:

  • Example: /about-0
  • Improved: /about

Common Cause: This URL error typically happens when more than one version of a page has been created with the same Page Title. Often an old version of the page is already using the desired URL and effectively blocking the ability to re-use it. The original page must be unpublished or deleted before the new page’s URL Alias can be set to the correct original URL.

Overly Long URLs:

  • Example: /annual-open-house-and-meet-and-greet
  • Improved: /open-house

Common Cause: Page URLs are created automatically based on your Page Title unless you uncheck Generate automatic URL alias in the URL Alias section. Remember to go to the URL Alias tab on the right side of the edit page and create a custom URL for each page unless the page title is the ideal URL.

How To's

How to Create a Custom URL Alias

When creating or editing most KU CMS pages:

  • Locate URL Alias accordion (upper right on desktop, lower left at mobile)
  • If present, uncheck Generate automatic URL alias
  • Enter properly-formatted custom URL in URL Alias field
  • Set Save as state to Published
  • Select Save

URL Redirects

A URL Redirect is a technique which is used to redirect your site's visitors to a different URL. At times it may be useful to have traffic that would normally go to one page redirect to another page.

Add a Redirect

  1. Under Configuration
  2. Go to Search and Metadata > URL redirects > Add redirect
  3. Enter the Path of the of the page you wish to redirect
  4. In the To field type the path that you want users redirected to
  5. Select the Redirect status* from the drop-down menu
  6. Select Save

*NOTE: Most of the time you will want to use 301 Moved Permanently. For more information about the Redirect status codes.

Delete a Redirect

  1. Under Configuration
  2. Go to Search and Metadata > URL redirects
  3. From the Edit button drop-down menu on the right select Delete
  4. Select Delete to delete the redirect

Edit a redirect

  1. Under Configuration
  2. Go to Search and Metadata> URL redirects
  3. Select the Edit button
  4. Make the desired changes
  5. Select Save

Checking Redirects on Your Drupal 7 Site

Be sure to review the redirects on your Drupal 7 site. You may need to recreate some redirects on your new CMS Sunflower site to ensure that end-users arrive at correct destinations on your new site. This likely applies only to the pages on your site that get the most traffic – and are most likely to have been bookmarked or linked to from other websites.

If someone has bookmarked or linked a page on your Drupal 7 site and you recreate that page on your CMS Sunflower site with the exact same URL, users will end up on the correct page and no additional redirect action is required.

However, imagine a scenario where one of your most heavily-trafficked pages has had a URL change in the recent past. For example, if you originally created a page with the URL “/about-us” and then sometime later came back and updated the URL to be simply “/about.” If someone bookmarked or linked to “/about-us,” once your new site goes live they will no longer arrive at the correct destination because that page does not exist on your new site. You can correct for this by adding a redirect.

Guidelines and Best Practices

  • Keep them simple – remove all extraneous words
  • Use hyphens between all words
  • When migrating use the same URL whenever possible - or add a redirect on the new site if you need to change the URL
  • Avoid automatically-generated URLs with numbers appended due to redundancy (e.g., /research-0)

Support