[mod_python] redirects and url rewriting

Daniel Popowich dpopowich at mtrsd.k12.ma.us
Mon Dec 22 19:55:13 EST 2003


>>      directory and send a "Location: http://host/foo/" header.  I was
>>      first shocked by this (think of all the extra bytes flooding the
>>      'net because of this!!), but understand it's the only way within
>>      the protocol to make relative links work.  (Although it begs the
>>      question why the protocol doesn't have a Real-Location header, or
>>      some such, to let the browser know what the real url for the
>>      requested page should be without having to go fetch it.)
>
> A 301 status is Moved Permanently, so that is your "Real-Location"
> header.  In an ideal world browsers would update (or prompt to update)
> bookmarks on such a status, but it looks like that's not going to
> happen.

I wasn't very clear.  For pages that have moved or for pages that haven't
moved but aren't in proper form (like my example, http://host/foo ->
http://host/foo/) on the SAME server, it seems unfortunate that the
servers can't return the page along with some header indicating that fact.

For example, why can't a request for http://host/foo return
http://host/foo/index.html with a header

  Real-Location: http://host/foo/

instead of returning a 30[12] with a Location header only to have the
browser go back to the same server.  Seems wasteful.

The 30[12] with Location header makes perfect sense for pages moved
to different servers.

Dan




More information about the Mod_python mailing list