1

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

http://example.org/p/1234/

is really

http://example.org/product/?product_id=1234

(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 http://example.org/p/1234/, 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.

2
  • 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. Aug 1, 2012 at 21:16
  • crickets crickets Aug 6, 2012 at 17:36

0

You must log in to answer this question.

Browse other questions tagged .