Creating a 301 Redirect (non-www to www)

Creating a 301 redirect

The following article will take you through creating a 301 redirect.  This will direct all non-www traffic to the www version of your website.

Step 1: Creating the 301 Redirect
1. Open Notepad (Start -> All Programs -> Accessories -> NotePad)
2. Copy and paste the following code into Notepad:

If Request.ServerVariables("SERVER_NAME") = "" Then
Response.Status="301 Moved Permanently"
End If

3. In the code, change "" to your website address (keep all other formatting)
4. Verify your homepage is called "index.html", otherwise, in the code, you may need to change "index.html" to "index.htm"
5. Go to File -> Save As
6. Change Save As Type to "All Files"
7. Enter a file name of "index.asp" (without the quotes)
8. Make a note of the location it's saving to, press Save
9. Exit out of Notepad

Step 2: Uploading the file

1. On your computer, open the folder that contains your "index.asp" file
2. Right-click on the "index.asp" file, select Copy
3. On your computer, press Start -> Run

Note: Vista users just need to press their Start button and enter Step 6 in their "Start Search" bar, which is right above their Start button.

4. Type in "explorer.exe" (without the quotes)

Note: For, enter the name and extension of your website.

5 Press OK or [Enter]
6. When prompted, enter your username and password
7. Press Log On
8. Double-click the httpdocs folder
9. Right-click, select Paste

This should upload the index.asp file to your website.

Step 3: Adding index.asp to the default document type
1. Go to
2. Login with your domain name and password
3. Press the Open Website Control Panel icon under Services
4. Press the Web Directories icon
5. Press the Preferences icon
6. Make sure "index.asp" is in the list under Default Documents Search Order.  If not, type in "index.asp" and press the Add button.
7. Verify "index.asp" is at the top of the Default Document Search Order list.  If not, select it and press the Up button until it is.

Step 4: Test your website.

Go to your website address (without the www) and make sure it is forwarding to the www version. 

Add Feedback