Information Technology Services - Computing, Networking and Storage

Server Redirects


A Redirect is an Apache directive (command) which maps one URL into another. The new URL is returned to the browser which attempts to fetch it again with the new address.

A redirect can be used to make a shorter or more logical URL for your web site. For instance, on the USCweb server, the School of Medicine pages are located in the /www/schools/medicine directory, which translates to the URL: http://www.usc.edu/schools/medicine.

However, there is a redirect which maps the shorter URL http://www.usc.edu/medicine to the actual URL. Try the link and watch the redirect URL be replaced by the actual URL in your browser's location window.

Root-Level Redirects

The above is an example of a redirect which occurs at the server root. For security reasons, root-level redirects can only be implemented by the USCweb administrators. Therefore, you must write to USCweb Administration to request a root-level redirect. Note that redirects slow down the functioning of the entire web server, so not all requests are granted.

Pages must meet all criteria on the USC Web site checklist in order to be considered for a root-level redirect.

Policy

Although most web authors would probably like to have a root-level redirect for their site, many schools and divisions prefer that member departments always be identified as belonging to the larger unit. For this reason, USCweb administrators will check with the Authorized Signer of the division or school before assigning a root-level redirect.

Local Redirects

You can also use redirects within your own web site by placing redirect directives in a local .htaccess file.

Syntax: Redirect URLpath URL
  • URLpath is the path of the URL to be redirected (from the server root) and
  • URL is the actual full URL.

As an example, in The Blue School there is an interdepartmental research group named Red. Red's web maintainer belongs to the Green department, so Yellow's web site was set up at http://www.usc.edu/schools/blue/green/red.

It's been decided that Red shouldn't be associated with just the Green department, so in the /www/schools/blue directory, the Blue School's web maintainer creates the file /www/schools/blue/.htaccess which contains the following directive:
Redirect /schools/blue/red http://www.usc.edu/schools/blue/green/red

Now the URL http://www.usc.edu/schools/blue/red will reach Red's web site.

In fact, since there is already a root-level redirect for the Blue School which shortens that URL to http://www.usc.edu/blue, Red's site can also be reached with the URL http://www.usc.edu/blue/red.



Last updated: Wednesday, August 30, 2006, 09:14AM PDT