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.

  • 1 Пользователи нашли это полезным
Помог ли вам данный ответ?

Связанные статьи

Your IP address has changed. Please log in again (cPanel)

If you are getting error like the one below when trying to access cPanel or your Webmail (on...

SolidCP Server information (Space summary) - Database

Hosting Space summary information gives you an overview of a particular hosting space and what...

Setting up ""default.aspx

You can do that by: Click the Domains shortcut in the navigation panel. Click the required...

SolidCP Upload limits

There is limit for max upload size on files in SolidCP. The limit is 200MB. If you want to...

How to connect to FTP with Web Browser? - cPanel

You can connect to FTP using your cpanel username and password or you can create new FTP account....

Powered by WHMCompleteSolution