Search code examples
asp.netiisweb-config

Redirecting specific requests from old domain


I'm already redirecting an old domain via a 301 redirect but I've noticed that I'm getting lots of requests for certain files and pages from the old site. How can I redirect these requests so that it just loads the new site? I'd like to do this for specific files only.

Edit: The website is on shared hosting, but I can edit the web.config file of course.


Solution

  • You'll have to create an entry in IIS for each file. Create the path structure on disk under the site's root and on that page in IIS create a redirect for the file in question. You can use notepad and explorer to make those files.

    That's the fastest manual way I know of in IIS6. IIS7 should be easier tho. In IIS7 you could edit the application host file.

    EDIT: see also ~ Which redirection is better - web.config or global.asax

    EDIT: see also ~ http://msdn.microsoft.com/en-us/library/ms228302.aspx