View Single Post

  #2 (permalink)  
Old 08-16-2003
Joachim Ring
 
Posts: n/a
Default Re: mod_rewrite: [internal redirect] returns 301

> but to the client '301 Moved Permanently' is returned:
>
> HTTP/1.1 301 Moved Permanently
> Location: http://[...]/usage/?c=usage
>
> I got absolutely no idea whats wrong. I don't think, the RewriteRule ist
> the problem, because in the RewriteLog everything is exactly as is should
> be. I suppose there is another module which causes things to get messed up.


i think you're right in saying that mod_rewrite is not to blame here.
the behaviour to send a redirect in the case of a user requesting a
directory without the trailing slash is perfectly normal:

GET /usage HTTP/1.0

HTTP/1.1 301 Moved Permanently
Location: http://[..]/usage/

is the normal behaviour - so this looks like apache has already
decided it needs to send a redirect with a trailing slash, but is
first having a quick look at the per-directory rewrite rules (which
are evaluated very late) and then gets confused (rewrite-engine ends
in internal redirect to /a/prc and has set query string but the info
that we need to have an external redirect to the dirname plus
trailing slash is still there and takes place.

things to try:

- use [R] to force an external redirect to /a/prc yourself
- move this rule into the httpd.conf - per-directory rules eat a lot
performance and have some hidden caveats which often come from the
fact that they're evaluated a lot later than regular rewrite rules in
httpd.conf.

joachim