Redirects on IIS

We’re in the process of redesigning our website, and since we’re using ColdFusion, all the .htm pages will now have a new .cfm extension. They’re also going to move, since we’re going to have a logical folder structure rather than 10,000 files dumped in the web root like we have now.

As we’re going along, we’ve been keeping a spreadsheet to keep track of the old page path/name and the new page path/name for each page. If we were using Apache, I could stick all these in an .htaccess file and be done, but I’m not sure if there’s a simple way on IIS.

The server guy tells me they have to be done one-at-a-time. Is this true? Is there a way to mass-add redirects?

Just a quick note to say that this worked exceedingly well. So well that we’re going to make it a standard here. Thanks!

Ugh, upgrade to SQL Express, its free and loads better.

You should be able to do this presuming you can make your own virtual directories, which can have independent global 404 pages, etc.

Moreover, this isn’t using a 404 page per se, but rather mapping the .htm extension to coldfusion then figuring out some way to patch any .htm requests to a specific coldfusion handler. Don’t know the archetecture well enough to answer that effectively.

Just a follow-up, I don’t think that final option will work for me. I only need to redirect files in certain folders, and the other folders belong to other offices, so they’re off-limits. I think with IIS, you have to set a global 404 and can’t just specify one for a particular folder like you can with Apache (via .htaccess).

There’s no way the webmaster would point to my CFM file for our global 404 page.

Your server guy lies to you. Or at least he isn’t thinking of all the tools in his toolbelt.

If you are using IIS7, there is built-in url rewriting or redirecting capabilities.

If you are using IIS6 and you have a dedicated server, you have some mod_rewrite like options.

If you are on IIS6 on shared hosting, you should probably move to IIS7 shared hosting. Failing that, you could easily redirect all requests to .htm to a custom cold fusion script which would lookup the requested page and then redirect to the new page. I’ve done very similar things in ASP.NET and it has worked beautifully.

Great tips! I’m pretty sure we’re using IIS6, but not shared.

I like that CF idea. I might try to implement it. I’m assuming the new and old page urls go into a database, and that’s how the dynamic page handles it. The only problem with that is that we use MS Access as a db, but I can probably cache the db query and avoid multiple db hits.

I’ve been begging for that for well over a year. If I held my breath while waiting for that, I’d have been dead a thousand times by now.