I had published my site before but to enhance SEO, recently I changed some page's names to match with keywords.
I changed the page name like this:
news page.aspx---->news-page.aspx
now I have a lot of problems with SEO. pages with previous names(news page.aspx) have indexed on google and when are clicked, the error 404returns.
"The resource cannot be found."
What I have tried:
I searched google and found that I should use redirect 301.
so I redirected the previous address to new in global.asax:
void Application_BeginRequest(object sender, EventArgs e)
{
if(HttpContext.Current.Request.Url.ToString().ToLower(). Contains("http://www.mysitename/news page.aspx"))
{
HttpContext.Current.Response.Status = "301 Moved Permanently";
HttpContext.Current.Response.AddHeader("Location",
Request.Url.ToString().ToLower().
Replace("http://www.mysitename/news page.aspx","http://www.mysitename/news-page"));
}
}
but the page doesn't redirect and still has a "the resource not found" error.