Best practices for relative links

When working with the University of Ottawa's Drupal platform, it is strongly recommended to use relative URLs over full URLs for links internal to a website. The reason for this is two-fold:

  • Relative links allow you to browse your website in both HTTP and HTTPS mode without interruption. Users who log in and click on a full HTTP URL can be misled to think that they got disconnected from the site and cannot edit the content on that page.
  • Images and files do not render for users outside of the University's network when they have HTTPS URLs.

1. Relative links in the WYSIWYG (text editor)

When adding a link in the WYSIWYG, simply use the full URL. We no longer recommend using relative links in this scenario.

    2. Relative links in Menu items, Related Links, Content Links, Panel Pages, Path aliases, etc.

    When you have to enter a path in a stand-alone field, like the Path of a menu item, the path of a Panel page, or the Link field of a Content Link, enter everything that follows your site name without any preceding slash.

    • Example: http://med.uottawa.ca/epidemiology/latest-issues/some-subpage
    • Relative path: latest-issues/some-subpage


    This also applies to files:

    • Example: http://med.uottawa.ca/epidemiology/sites/med.uottawa.ca.epidemiology/files/my-awesome-file.pdf
    • Relative path: sites/med.uottawa.ca.epidemiology/files/my-awesome-file.pdf

    3. What if the link is outside of my site?

    If the link is not within your site, use the full URL. For example, if I’m working on the Epidemiology website and want to make a link to the Music website (http://arts.uottawa.ca/music/), then I’ll use the full path.

    » Submit feedback
    Back to top