image rewriting does not rewrite content-location

Topics: Developer Forum
Feb 18, 2008 at 9:46 AM
Edited Feb 18, 2008 at 12:30 PM
Hi, I am rewriting some image names and it seems to work (i can access them via the new name) but the http response header "content-location" still shows the original image name.

eg.
1) request 2334_my-image-name.jpg (this file doesn't exist)
2) rewrites to 2334.jpg (this file actually exists on the server)
3) http response header content-location="2334.jpg"

Is this normal behaviour or am I doing something wrong? I am wondering if content-location can also hold the new name of the image? I want to remove all references to the old image names from search engines and am worried some may read the content-location and use that rather than the referencing url?
Coordinator
Feb 18, 2008 at 2:53 PM
I don't understand ? your statement #3 seems to indicate that the content location is the updated image name?
which contradicts your claim?

I'm missing something...
Feb 18, 2008 at 9:07 PM
hmm maybe I'm not clear. This is how I imagine I'd like things to be (but am not sure if there is something wrong with this view or not)

1. Client requests image "2334_my-image-name.jpg"
2. Browser requests "2334_my-image-name.jpg"
3. ISAPI rewrites this request and serves contents of "2334.jpg" to IIS
4. IIS returns the image to the client, with HTTP 200 and Content-Location "2334_my-image-name.jpg"

So #4 is where I am not clear why does Content-Location still hold the image name before it was being rewritten?
Why is Content-Location = "2334.jpg" and not "2334_my-image-name.jpg"
Coordinator
Feb 18, 2008 at 9:53 PM

davidbee wrote:
4. IIS returns the image to the client, with HTTP 200 and Content-Location "2334_my-image-name.jpg"

So #4 is where I am not clear why does Content-Location still hold the image name before it was being rewritten?
Why is Content-Location = "2334.jpg" and not "2334_my-image-name.jpg"


Your question still seems to contradict your statement. What is the value of Content-Location and what is the value you expect it to be?

I think you expect Content-Location to be set to the rewritten URL. This is probably not how it works. In fact IIRF does not set the Content-Location meta tag, so it is whatever the app and IIS set it to. The rewrite is a server-side only thing. Any requesting client (including browser, but also search spider) is none the wiser as to the rewrites that happen server-side. The browser still sees the original (un-rewritten) URL. If you want to redirect, that is a different story. For that you would use the [R] flag. When requesting 2334foobar_bah.jpg, which is redirected to 2334.jpg by your rule in IIRF, the browser itself would receive a reply (eg 302), and would then automatically submit a new request for 2334.jpg. The content rendered would then have the appropriate Content-Location tag.

Feb 19, 2008 at 3:09 AM
ah ok. yeah I see what's going on now. thx for the explanation!