cyprich.com

Occasionally Relevant Insights from a Software Builder

By

How to Redirect Web Pages in IIS

Redirecting web pages becomes necessary when a web site is updated and old pages are replaced with new ones. This is very common when a site is upgraded to a CMS which typically displays pages as folders (i.e. www.website.com/about) as opposed to www.website.com/about.htm.

Its important to redirect old pages to new ones because if the old page is bookmarked in a web browser, it will lead to a 404 error page and the user will probably not try to manually change the URL to go to the home page. Also, its better for SEO to have a consistent page structure in your site.

Redirection in IIS

The easiest way to redirect web pages is through the Management Console in IIS in Windows. Find the page you want to redirect, right click on it, and select Properties. This will give you the following dialog box.

Redirecting a Page in IIS

Select the A redirection to a URL radio button and enter the URL of the new page in the Redirect to textbox. Press the OK button to save the settings. When the page is viewed in a web browser, it will automatically redirect the browser to http://www.website.com/about.

Redirecting Using HTML

You can also give instructions to redirect in a web page. The page that needs to be directed will contain the code below. The meta tag should be enough to do the redirect, but on some web servers it may not work. The JavaScript below will redirect only if JavaScript is enabled on the user’s web browser. The meta redirect is done on the server side and doesn’t require any settings on the user’s part.

<html>
<head>
<meta http-equiv=”Refresh” content=”0; http://www.website.com/about”>
</head>

<body>
<script language=”javascript”>
window.location = “http://www.website.com/about”;
</script>
</body>
</html>

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>