OREGON STATE UNIVERSITY

How do I set a URL redirect in OSU Drupal?

URL redirects can be set right through the OSU Drupal interface, as long as the base URL of the new site matches the base URL of the old URL.

So, for example, a static site with the base URL of http://oregonstate.edu/cws/my-old-page.html could be redirected to a new page in Drupal that had the URL http://oregonstate.edu/cws/my-new-page.

This will also work with files.  For example an image file located at http://oregonstate.edu/cws/old-directory/my-image.png could be redirected to a new file instance in Drupal that had the URL http://oregonstate.edu/cws/sites/default/files/new-directory/my-image.png.

An original base URL that differs from a new base URL will not work, though.  So, for example, you would not be able to redirect something like http://oregonstate.edu/old-cws/my-old-page to something like http://oregonstate.edu/new-cws/my-new-page.  The base URLs old-cws and new-cws are different and the new site will not recognize the base URL old-cws.

Here are some examples of rewrites that you can test out:

This is a redirect test from a static page that uses an .html extension.

This is a redirect test from a static page that uses an .htm extension.

This is a redirect test from a file from a static site into sites/default/files.

Setting a redirect in OSU Drupal is quite simple:

  1. Go to Admin menu > Site building > Add redirect.
  2. In the From field, enter the original path that follows your base URL.
  3. In the To field, enter the new, relative path that follows your base URL.
  4. Click the Save button.

Redirects should be set relatively. 

Please note that if you are setting redirects in a development site in drupaldev, your redirects will not work with your production site's base URL until you replace your old site with your new one.

Make sure to test your new redirect in your production site.  You can do this easily by simply entering your old URL in the address bar or creating a test link on some page in your site with the original URL, such as what is shown in the example above.