If you ever change a website that has some search engine rank or visitors you should do a “301 Redirect”. There are a couple different types of redirects. A 302 redirect is called a temporary redirect. A 301 Redirect is a permanent redirect.
Search engines don’t usually follow 302 redirects. However, they “should” follow 301 redirects.
Normally in C#/.Net you will say “Response.Redirect(”http://www.google.com“);” However that is a 302 redirect. To do a 301 you will want to do the following….
Response.Status = “301 Moved Permanently”;
Response.AddHeader(”Location”, “http://www.google.com“);
This is your best attempt at keeping all the search engine work that you’ve done.
Now normally you would have to go to each ASPX file and add this in each’s page load/init section. I however have used master pages so I just need to add it to one spot. However I have to figure out which page is actually getting requested. Here’s how to do that.
protected void Page_Load(object sender, EventArgs e)
{
string Redirect = Request.Url.AbsoluteUri.ToLower().Replace(”jaygeiger.com/rent-games”, “tempgames.com”);Response.Clear();
Response.Status = “301 Moved Permanently”;
Response.AddHeader(”Location”, Redirect);
}
This way we replace the old url with the new one then do a 301 redirect.
If you don’t have a master page, you can still do something similar with your Global.asax file as seen HERE.
Now that we’ve got the redirect done, we can wait until Google catches on and then redirect our AdWords campaign.
