InfoQuest Knowledgebase InfoQuest Knowledgebase

  • Home
  • Knowledgebase
    • Billing
    • Control Panel
    • Data Center
    • Databases
    • Domains
    • Email
    • FTP
    • Hosted Exchange
    • SSL Certificates
    • Virtual Private Servers
    • Webmail
    • Website Hosting
  • FAQ
  • Contact
  • Visit InfoQuest.com
Home / Website Hosting / Permanent 301 redirect

Permanent 301 redirect

Permanent 301 redirect from http:// to http://www

Replace “yourdomain.com” with your actual domain, and name the file as global.asax

<%@ Application Language=”VB” %>
<%@ Import Namespace=”System.Diagnostics” %>

<script Language=”VB” RunAt=”server”>

Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal e As System.EventArgs)
Try
Dim requestedDomain As String = HttpContext.Current.Request.Url.ToString().ToLower()

If InStr(requestedDomain, “http://yourdomain.com”) Then

requestedDomain = requestedDomain.Replace(“http://yourdomain.com”, “http://www.yourdomain.com”)

Response.Clear()
Response.Status = “301 Moved Permanently”
Response.AddHeader(“Location”, requestedDomain)
Response.End()

End If

Catch ex As Exception
Response.Write(“Error in Global.asax :” & ex.Message)
End Try
End Sub
</script>

Website Hosting

Related Articles

  • Professional Services
  • iframe Dynamic Height Script
  • Where do I go to leave positive feedback for support?
  • Improving Website Performance

Knowledgebase Categories

  • 7Billing
  • 50Control Panel
  • 4Data Center
  • 4Databases
  • 12Domains
  • 58Email
  • 4FTP
  • 38Hosted Exchange
  • 7SSL Certificates
  • 25Virtual Private Servers
  • 5Webmail
  • 47Website Hosting

Most Helpful Articles

  • How to change WordPress siteURL to IP address using phpmyadmin (POA)
  • Remove index.php from WordPress URL (POA)
  • How To Setup An Archive Folder in Outlook for MAC (POA)
  • How to Redirect a Registered Domain (POA)
  • Share Exchange Outlook calendar on iOS devices (POA)
  • Changing the WordPress URL Path to web root “/” or another path (POA)
  • Where do I go to leave positive feedback for support?
Copyright © 2020 - InfoQuest Technologies, Inc.