Redirecting Visitors

From Campus Web Server Help

Jump to: navigation, search

To redirect visitors to another site, you have some options. Options that return header response codes are preferred. See Google's tips on redirection. Here are a couple of ways to redirect clients.

Redirect and RedirectMatch in .htaccess

A Redirect directive in an .htaccess file will send users trying to access a given file to the new location.

Redirect 301 /yourURIpath/file.htm  http://newdomain.uga.edu/otherpath/welcome3.htm

The "301" indicates to the client that the page has moved permanently.

The RedirectMatch directive is much more powerful, allowing for the matching of regular expressions in the URL path.

RedirectMatch 201 (.*)$ http://anotherdomain.uga.edu$1

For complete instructions, see the official Apache documentation.

HTML Meta Refresh

This method is not interpreted by search engines or spiders. Create a file called index.html in your home directory and remove any other default page (default.html, index.php, etc). The index.html file should read something like:

<HTML>
<HEAD>
<META HTTP-EQUIV="refresh" content="5;URL=http://www.yoursite.com/newpage.htm">
<TITLE>Page has moved</TITLE>
</HEAD>
<BODY>
This page has moved. Please update your bookmarks as this redirect will
be removed /INSERT TODAY+1 YEAR HERE/.
<br><br>

If your browser does not automatically redirect you in a few seconds, click
<A HREF="http://www.yoursite.com/newpage.htm">here</A> to go to the new page.
</BODY>
</HTML>

Of course, this can also be used as the content of any page that you'd like to redirect elsewhere. The '5' in the content attribute defines the number of seconds to wait before redirecting the user.

Personal tools