I have several domains sharing the same site and use a default.asp as the default file where I test the SERVER_NAME variable and use Response.Redirect to redirect to the home page of the site requested.

The problem is that this type of redirect causes 302 status code. Even when having a rewrite section in my web.config where I created one redirect rule for each site with redirectType="Permanent", the status code 302 is returned.

That is bad for ranking pages in Google's index. Does somebody know a way to solve that problem and return 301 status code?

  • Redirecting to the home page is also bad for SEO. If you want redirects to pass SEO value they have to be deep redirects. Google considers redirects to the home page to be "soft 404" errors and treats them the same as if the page were not found. Jan 25, 2021 at 10:58

2 Answers 2


I'm assuming you're using classic ASP (not .NET) since you refer to default.asp and not default.aspx.

Instead of using response.redirect and counting on your web config file to change from a 302 to a 301, try adding the 301 to the response object before redirecting the user.

Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "new_page_name.asp"

If you're actually using .NET, then use the following:

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

See https://docs.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms525844(v=vs.90) for more information.

  • 1
    Hi, Trebor. Thanks for the help, but I found that the Httpresponse object has a method named RedirectPermanent that returns 301 status code. I changed my code to Asp .NET and the problem was solved. Jan 25, 2021 at 20:04

I solved the problem with Response.RedirectPermanent using Asp.NET. This method returns a 301 status code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.