Tips Station Asp.net Article Seo Articles
Tutorials Code Samples
›  Home
›  Mission
›  About us
›  Contact Us
›  Feedback
›  Terms & Condition
Asp Articles
IT Solutions
 
› ASP.NET

› Programming Tips

› Ajax

› Asp

› ADO.NET

› Databases

› SEO

› CSS And Designing

› Php

 
Most Viewed Articles
 
› Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

› Change theme dynamically without page refresh in ASP.NET

› Install AJAX On Machines Running Visual Studio 2005

› Creating Pretty Popups Using AJAX

› Simple ASP Image Resize Function

› SQL Server Performance Counters

› ASP.Net Interview Questions And Their Answers

› Encode Url using ASP

› Difference Between DataGrid and GridView in Asp.Net

› Select Specific Value WithIn Drop Down List Or Radio Button List

more...
 
 
Home> Asp
 
How To Set Up A 301 Redirect On IIS
 

To further elaborate on a article I wrote: 301 Redirects And Domains With And Without WWW, I wanted to discuss the actual implementation of a 301 redirect on IIS.

I was recently asked by a client on detailed instructions on how to properly set up a 301 redirect on IIS to redirect a non-www domain to the www domain. This cannot be done in the IIS control panel because when set up the IIS will force the website to loop to itself, thus never loading in a browser properly. In Apache this can be done with a couple of simple lines of code in the .htaccess file. In IIS it is much more difficult...but not impossible.

First off, to be clear, you have two options:

1. You can create a new IP based web site in Internet Services Manager using the mydomainname.com address. You will now have two websites set up in IIS one for www.mydomainname.com and one for mydomainname.com. of course not everyone has an extra IP to do this. If you don't you can use the option below.

2. You can add another website on the same IP with the host header value (virtual website) option. The second website would be mydomainname.com under the host header domain of www.mydomainname.com.

Once one of these are set up you see both will return a 200 server response when checking the server headers.

Of course our next step would be to change the server response for mydomainname.com domain to show 301 redirection to www.mydomainname.com. Here is the code you should put in the NEW default home page file for mydomainname.com:

ASP:

< %@ Language=VBScript %>
< %
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", http://www.mydomainname.com
%>

It should show a 301 response and then redirect to www.mydomainname.com.

Of course you could do this without creating a new website by using ISAPI_Rewrite, but this is not available on most hosting accounts. You could install it yourself, but once again not sure if the hoster will even support it for you. IIS can be very yucky sometimes, but using the instructions above you can implement the 301 redirect your looking for.

This article has been taken from webdesign.org.

 
 
Vrp Technologies
 
Serversea Hosting
 
 
Latest Articles
 
› Sending SMS With PHP

› MySQL Join Tutorial

› Make An RSS Feed Using PHP

› Intro To Object: Option Variables

› Design An Online Chat Room With PHP And MySQL

› Create Tell A Friend Script With HTML & PHP

› Benchmark And Optimize PHP Script Speed

› What Kind of DBA Are You?

› SQL Server Performance Counters

› SQL Server Performance Tips

more...
 
Random Articles
 
› Benchmark And Optimize PHP Script Speed

› Select Specific Value WithIn Drop Down List Or Radio Button List

› Writing SEO Friendly URL using HttpHandlers in ASP.NET

› Ajax - The Basics

› How to modify expire date of a cookie using Asp

› Application Object in Asp

› Install AJAX On Machines Running Visual Studio 2005

› ASP.Net Tips and Tricks

› Simple ASP Image Resize Function

› Get To The Top 10 Website Search Engine Rank In 5 Easy Steps

more...
 
Home Mission About us Contact us Feedback Terms Conditions
2008 © Copyright TipsStation. All rights reserved.