Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Okay, so I have URL rewriting set up on my server (IIS 7) so that, for example,

is really

(With /product/ containing an index file for a web app that's able to process the query params).

The problem is, I want everyone to use the /p/1234/ urls now, so I'd like to send a 301 redirect whenever someone visits the old url of /product/?product_id=1234, but as far as I can tell when URL rewriting occurs, as far as the server is concerned the user did go to /product/?product_id=1234.

Although in the browser's URL bar it may say, when I do a dump of headers and CGI variables, /p/1234/ doesn't show up in any of the variables.

I guess my concern is, even if I can do this, it seems like it would make a simple request fairly convoluted:

  1. Go to /p/1234/
  2. Rewrite it to /product/?product_id=1234
  3. Was it originally /p/1234/? (yes)
  4. Do nothing.

And otherwise:

  1. Go to /product/?product_id=1234
  2. Was it originally /p/1234/? (no)
  3. 301 Redirect to /p/1234/
  4. Rewrite it to /product/?product_id=1234
  5. Was it originally /p/1234/? (yes)
  6. Do nothing.

I know that eventually some search indexes will eliminate the old URLs in favor of the ones specified by the 301 redirect, but until then it seems like a lot of overhead for the servers.

Also, if I did set this up, is there a filter I could use in IIS to do this, or would I need to add the logic to my webapp?

Note that I have set up <link rel="canonical".../> for all of these webpages but I still see the old format showing up in search results.

share|improve this question
Just did another dump of the headers and it appears that IIS does make them available under a proprietary header X-Original-URL. Still curious about the impact of using 301 redirects in this case. – Jordan Reiter Aug 1 '12 at 21:16
crickets crickets – Jordan Reiter Aug 6 '12 at 17:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.