Types of Redirects

There are two ways of creating a redirect:

  1. http://siteA.cornell.edu/url1 -> http://siteB.cornell.edu/url1
  2. http://siteA.cornell.edu/url1 -> http://siteB.cornell.edu/url2

In the first example any URL that ends with "url1" will go to "url1" on the new site.  In the second example any request to siteA will always go to "url2" on siteB.

A typical use of "1" type of redirect would be: http://myoldname.cornell.edu -> http://newname.cornell.edu where the content on "myoldname" and "newname" is identical.

A use of "2" type of redirect would be where you have a substantial amount of changes and you may want to redirect the user to a page that alerts them about changes, i.e. http://oldsite.cornell.edu -> http://newsite.cornell.edu/welcome-oldsite-users.html

Note that it is NOT possible to automatically create a redirect by pointing the DNS for siteA to siteB.  In some cases this may simply cause both siteA and siteB urls to work without a redirect or it may not work at all.  For a redirect to be setup it requires that a webserver be configured to perform the redirect.

Creating "1" Redirect

This is can be created by creating a ".htaccess" file that contains:

Redirect / http://siteB.cornell.edu/

Make sure to have a trailing slash!

The ".htaccess" should be placed in the "DocumentRoot" of the site. This is typically the same directory that would contain the "index.html", "index.cfm", "index.php", etc... that contains the content of http://siteA.cornell.edu/

For example:

htdocs/siteA/index.html
htdocs/siteA/.htaccess

Create "2" RedirectMatch

This is can be created by creating a ".htaccess" file that contains:

RedirectMatch .* http://siteB.cornell.edu/url2

The ".htaccess" should be placed in the "DocumentRoot" of the site. This is typically the same directory that would contain the "index.html", "index.cfm", "index.php", etc... that contains the content of http://siteA.cornell.edu/.  Not all webdav clients (i.e. Windows 7 folders) support modifying ".htaccess" files, it may be necessary to use a client like BitKinex or Cyber Duck that allows ones to modify ".htaccess" files (this is a limitation of the client program).  A workaround for using Windows 7 folders can be found at: http://www.techpavan.com/2009/01/16/create-htaccess-windows/

For example:

htdocs/siteA/index.html
htdocs/siteA/.htaccess

More information

  • No labels