Posts Tagged ‘website’

Techie Tip of the Week: Redirect Web Pages to New Locations – permanent redirect method

Friday, March 2nd, 2012

Last week, we talked about using the META REFRESH method to redirect visitors to your web pages to new locations. This week, we’ll show how you can manipulate the web server to permanently redirect visitors to the new location even before the old web page opens.

Permanent Redirect Option

To permanently redirect visitors to new locations:

  1. Create a text file with the filename .htaccess
  2. In this .htaccess file, enter the following, substituting oldlocation with the relative reference to the redirected page (relative to the root level of the web server) and newlocation with the fully-qualified (complete, full address) URL of the new location:

    redirect 301 oldlocation newlocation

    So, for example, if the old location was http://www.stanford.edu/group/widgets, and the new location is http://www.stanford.edu/dept/cgi-bin/widgetdepartment, the .htaccess file should read:

    redirect 301 /group/widgets http://www.stanford.edu/dept/cgi-bin/widgetdepartment

  3. Save.
  4. Upload the .htaccess file to the appropriate directory on your web server.

Another way to implement a 301 (permanent) redirect:

Upload a .htaccess file in the directory you wish to redirect from with the following:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) newlocation$1 [R=301,L]

So, in our example:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*)
http://www.stanford.edu/dept/cgi-bin/widgetdepartment/$1 [R=301,L]

Techie Tip of the Week: Redirect Web Pages to New Locations (meta refresh method)

Friday, February 24th, 2012

Has your group redesigned your website and moved to a new location? Renamed your organization’s name? Want to automatically redirect visitors to your web site to the new location? This week and next week’s tips will show you how.

There are basically two options to redirect visitors to your web site to a new location: the meta refresh method and the permanent redirect method. This week, we’ll show the META REFRESH method.

Redirecting using META REFRESH

NOTE: This method works best if you are only redirecting a single page to a new location.

  1. Open the source code of the web page you wish to redirect in a text editor.
  2. In the HEAD section, enter the following code (substitute num with the desired number of seconds the browser will wait before redirecting; substitute newlocation with the new URL.

    <meta http-equiv="refresh" content="num; url=newlocation" />

    So, for example, to redirect to stanford.edu after 3 seconds:

    <meta http-equiv="refresh" content="3; url=http://stanford.edu" />

You can also use the META REFRESH method without the URL to have a web page automatically reload after a certain number of seconds. Newspaper and other news-oriented web sites often do this.

For example, to automatically reload the browser every 30 minutes (1800 seconds):

<meta http-equiv="refresh" content="1800" />


Next week, we will talk about Option 2: permanent redirects!