CAll Us 24/7: +1 (480) 624 2500 Support

If you renamed or moved pages of your website, a 301 redirect lets you automatically redirect visitors and search engine spiders to your new pages while maintaining your search engine ranking.

For example, you can redirect traffic from oldpage.php (.asp or .jsp) to “” and retain your search engine ranking and back links.

Use the code below to redirect traffic to your pages using a 301 Redirect.

 Note: In the code examples below, replace “oldpagename” with the name of your old Web page from which you want to redirect traffic and replace “newpage.html” with the name of the new Web page to which you want to redirect traffic.


Save this as oldpagename.php

header("HTTP/1.1  301 Moved Permanently");


Save this as oldpagename.asp

<%@ Language=VBScript %>
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", ""


Save this as oldpagename.aspx

<script language="c#" runat="server">
private void Page_Load(object sender, System.EventArgs e)
Response.Status = "301 Moved Permanently";


When using a Linux server with the Apache Mod-Rewrite module enabled, you can create a .htaccess file to ensure that all requests to will redirect to, where “” is your domain. Save the .htaccess file in your old website’s root directory, which is the same directory as your index file. You can create a .htaccess file with the following code:

RewriteEngine on
rewritecond %{http_host} ^ [nc]
rewriterule ^(.*)$$1 [r=301,nc]

IIS on VPS or dedicated server

When using a Windows server, you can redirect to a 301 page using IIS.

  1. In the Internet Services Manager, select the file or folder you want to redirect.
  2. From the right-click menu, select a redirection to a URL.
  3. Specify the file name of the page to which you want to redirect.
  4. Select The exact URL entered above.
  5. Select A permanent redirection for this resource.
  6. Click Apply.