What's the best way to redirect an entire classic ASP website to a new domain?

asp-classic, iis

Solution

I do not know if there is a better method, but what I do is using IIS permanent redirect:

- Go to the "Home Directory" tab of the site properties

- Select option "A redirection to a URL"

- Enter "http://yournewurl$S$Q" in the "Redirect to" text box

- Check both the options "The exact URL entered above", and "A permanent redirection for this resource"

So all requests for `http://youroldurl/path/page?querystring` get permanently redirected to `http://yournewurl/path/page?querystring`

More details can be found here.

PS: Above are steps for II6, IIS 7 might differ, I can't really recall.

Update:

Using 404 direct with the following in the default page and the 404 page:

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

Problem

I need to redirect an entire classic asp based website to a new domain whilst still maintaining the search engine ranking of the old site. I think a 301 redirect is required but not sure what the best way of doing this would be as I don't think .htaccess works on an IIS Windows based server. I would prefer not to have to change existing ASP files individually as there are quite a few. Any suggestions would be great. Thanks in advance.

Original source