Hello Luke
On Thu, 3 Apr 2003, Luke Opperman wrote:
> I was about to send this out, so I'll agree with Ian. Are
> you using mod_rewrite to map your servlets as well (ie, is
> that taking preference over this backwards compatibility
> rule?) To expand, I would expect the rewrite rule to look
> something like:
>
> (Note: Querystring parsing is very mucky in mod_rewrite, so
> I would suggest if it is possible for your new servlet to
> accept the same get-variables? ie, in the servlet accept
> 'pmid' as an alternative to 'id'. If yes, then:)
>
> RewriteRule ^/public/page\.html ^/public/de/otherpage [L,PT]
>
> (If not, then perhaps.....)
>
> RewriteCond %{QUERY_STRING} pmid=([^&]*)
> RewriteRule ^/public/page\.html ^/public/de/otherpage?id=%1
> [L,PT,QSA]
Great, thanks for your suggestions! I tried that second approach, with
a slight modification:
RewriteCond %{QUERY_STRING} pmid=([^&]*)
RewriteRule ^/public/zeige_pm\.html /public/de/news/%1 [R=perm,QSA]
because news/num should be the new "official" interface and so, I send
a redirect back to the client to "give him" the new URL. Alas, there
remains a problem: The redirect URL appears in the browser as
/public/de/news/num?pmid=num , i. e. the query string is appended
though not wanted. I checked that also in a telnet session; the
Location header contains the query string, the URL isn't made up by
the browser.
I tried to leave out the QSA flag, but then Apache complains (in
apachectl configtest):
RewriteRule: invalid HTTP response code for flag 'R'
which also occurs if I remove the "=perm", so that the options read
only "[R]".
Does anyone have an idea or workaround on how to get rid of the
appended query string?
If it's not doable with mod_rewrite, I should still be able to rewrite
the old URL - internally - to /public/de/news?pmid=num and let this
servlet send a redirect to the official URL. That would at least spare
me an extra servlet for the redirect.
Stefan
|