On Webserve, how do I redirect to a different URL using the meta refresh tag?

On Webserve, the default version of PHP is 7.1; however, PHP 5.6 will still be available until it is retired at the end of December 2018. Webtest servers are already using PHP 7.1. For help specifying which version of PHP to use, see PHP server-side scripting language.

If a URL has changed or was incorrect when it was printed or released, you can use the meta refresh tag to let users know the correct URL and automatically redirect them to the new page. The refresh tag can also help make your site more user friendly; if the correct URL is confusing or easy to misspell, you can provide a page at the "wrong" address that automatically redirects users to the correct URL.

Meta refresh example

Note that meta tags go in the <head> </head> section of the HTML document. Also, text within the title tags plays an important role in ranking web pages high for searches. Therefore, it is important to change the text within the title tags.

    <title>Web Services Support redirect</title>
    <META http-equiv="refresh" content="5;URL=http://www.indiana.edu/~account/new-directory">
  <body bgcolor="#ffffff">
    <center>The contents you are looking for have moved. You will be redirected to the new location automatically in 5 seconds. Please bookmark the correct page at <a href="http://www.indiana.edu/~wmhelp/new-directory"> http://www.indiana.edu/~wmhelp/new-directory</a>

The number in the refresh content="5 portion of the meta tag statement determines how many seconds a redirecting page displays. To immediately send visitors to the correct page, set the number to 0, as in this example:

<META http-equiv="refresh" content="0;URL=http://www.indiana.edu/~account/new-directory">

If you would like to use a redirecting page because a URL has changed, simply replace the document at the original location with one that redirects users to the new URL. It's good practice to indicate that the redirecting page will only be available for a limited time and urge visitors to bookmark the new location.

Not all browsers support meta refresh, so it's a good idea to include a clickable link to the correct URL.

Redirecting users with the .htaccess file

You can also redirect users to a different URL using the .htaccess file; see On Webserve, how do I redirect to a different URL using the .htaccess file?

This is document bfrh in the Knowledge Base.
Last modified on 2017-07-01 00:38:45.

Contact us

For help or to comment, email the UITS Support Center.