URL Redirection for Windows plans (web.config)

Redirect your website to another URL via code

If you wish to redirect your website to another URL via code, please follow the steps below:

With ASP code directly in the "default" webpage:

  1. Open the web-page via File Manager or a FTP client.

  2. Add the following code to your web-page, replacing www.domain.com with the new URL where you wish to redirect to:

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

PS. Change domain.com to the URL to which you wish to re-direct the website.

With ASP.NET code directly in the "default" webpage:

1. Open the web-page via File Manager or a FTP client.

2. Add the following code to your web-page, replacing www.domain.com with the new URL where you wish to redirect to:

private void Page\_Load(object sender, System.EventArgs e) { Response.Status = "301 Moved Permanently"; Response.AddHeader("Location","http://www.domain.com"); }

PS. Change domain.com to the URL to which you wish to re-direct the website.

Using WEB.CONFIG 301 redirect:

This example, will redirect important pages of your site that have .htm extensions and you want the new location to be its own directory (IE. http://domain.com/services.htm will change to http://domain.com/services/).

  1. Edit the web.config either via File Manager or FTP client.

  2. Add the code below:

`

`

PS. You may add as many location paths as necessary.

This example will redirect an entire directory to a new location. To do that proceed with the same steps as in the first example, only change the code with the one below:

``

PS. Change http://domain.com/newdir with the new URL to which you wish to re-direct. 

Redirecting non-www to www using WEB.CONFIG:

Generally redirection of non-www to www is made for search engine optimization purposes. This redirection uses the URL Rewrite module which is installed on all of our Shared Windows Servers.

1. Edit the web.config either via File Manager or FTP client.

2. Add the code below:

`

`

PS. Change domain.com to the URL to which you wish to re-direct the website.