Web resources that are intended for the whole
public, the University of California system, or all of UCSB
should be referenced by URIs that do not change. Examples of
these global resources include campus maps, visitor resources,
UCSB policies pages, major department/division home pages,
official UCSB artwork, and the like.
When URIs change, old bookmarks and search engine results
become obsolete. The information becomes more difficult to
find, less prominent, and creates a maintenance burden for
all other sites and pages referring to them.
Instead, create URIs that "don't go away." The following
recommendations will make these resources more useful as permanent
bookmarks and more easy to access from search engines. Of course,
always test your links after making any changes.
Recommendations for Building a Persistent
URI
- Don't include file extensions that expose or require a
media type. Although Web servers have been delivering html
files from the beginning, future Web servers may, for example,
deliver xml or xhtml files of various versions. Many browsers
will attempt to map the file extension (after the last period)
to a file type. Then if your framework or technology changes,
all the URIs with file extensions will have to change.
Example
Original URL: http://www.department.ucsb.edu/webguide/index.shtml
Persistent URI: http://www..ucsb.edu /webguide
- Don't include anything in your URI that is specific to
a programming language or platform, such as .pl, .php, .jsp,
servlet, cgi-bin etc. Presentation technologies may change,
but the data (or purpose of the data) will not.
Example
Original URL: http://www.department.ucsb.edu/archives/index.php
Persistent URI: http://www.department.ucsb.edu/archives
- Do not hint at whether the global resource page is static
or dynamically generated. As in item 1, URL parameters passed
in dynamically generated pages (i.e, pages whose URIs include
a ? and & characters with text) are subject to change.
Example
Original URL: http://www.department.ucsb.edu/cgi-bin/calendar.cgi?month=7&events=all
Persistent URI: http://www.department.ucsb.edu /current-events
- Try to avoid a trailing "/" in your persistent
URI so that users never have to consider whether the URL
requires it or not.
Example
Original URL: http://www.department.ucsb.edu/faculty/
Persistent URI: http://www.department.ucsb.edu/faculty
Techniques for Creating Persistent URIs
The best solution is to have the URI rewritten on your server.
The technique will vary according to your platform or programming
language. The Apache Web server, for example, has powerful
features to help you do this and it can be installed as a proxy
in front of many other Web applications.
To illustrate with the example from Item 3 above: when receiving
a request for "/current-events", the server at www.department.ucsb.edu
will rewrite the URI to "/cgi- bin/calendar.cgi?month=7&events=all".
Users will only see the persistent form of the URI which they
can bookmark, while the server can use the existing script
and rewrite the request to include the current month, etc.
Rewrite the URI on the Server
The best solution is to have the URI rewritten on your server.
The technique will vary according to your platform or programming
language. The Apache Web server, for example, has powerful
features to help you do this and it can be installed as a proxy
in front of many other Web applications.
To illustrate with the example from Item 3 above: when receiving
a request for "/current-events", the server at www.department.ucsb.edu
will rewrite the URI to "/cgi- bin/calendar.cgi?month=7&events=all".
Users will only see the persistent form of the URI which they
can bookmark, while the server can use the existing script
and rewrite the request to include the current month, etc.
Maintain a Redirect Page in a Permanent Location
A simpler solution for making a persistent URI is to create
a redirect page in a location you know will not change (set,
for example, as the default page in a directory created for
the purpose). If the URL of your global resource page changes,
you simply update the redirect page.
Set Your Resource as the Default Page in a
Directory
The simplest solution for creating a persistent URI is to place
your global resource page in a directory and use your Web server
software to designate it as the directory's default page. Using
the example from item 1 above, the page "index.shtml" is
set to be the default page of the directory "webguide." The
URI may need to end in a "/" against the recommendation
of item 4 above, but nevertheless provides a persistent link.
Use Redirects When Long-Lived URLs Change
Finally, consider using a redirect whenever you change the
location of a global resource that has been available at one
URL for a long period of time, since that URL will effectively
have functioned as a "persistent link" itself.
References
http://www.w3.org/Provider/Style/URI