httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 36590] mod_rewrite type|T force mime type option doesn't work
Date Sun, 07 Mar 2010 12:18:15 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=36590

--- Comment #8 from Eric Covener <covener@gmail.com> 2010-03-07 12:18:14 UTC ---
> If I use the following rule:
> RewriteCond %{REQUEST_URI} \.t$
> RewriteRule ^(.*)\.t$ $1 [T=text/html]
> 
> The flag T will never work. But when I modify it to the following rule:

That's because you're in per-directory context and by changing the URL you've
asked Apache to recalculate all of this.

> RewriteCond %{REQUEST_URI} \.t$
> RewriteRule ^(.*)\.t$ $1
> RewriteRule . - [T=text/html]
> 
> Then, the Content-Type in header is set properly.
> 
> But now, I need a more flexible rewrite rule that I can set the MIME-Type in
> the request url, so I modify it again to:
> RewriteCond %{REQUEST_URI} \.t$
> RewriteRule ^([a-zA-Z]+/[a-zA-Z-]+)/(.*)\.t$ $2 [E=MIMETYPE:$1]
> RewriteRule . - [T=%{ENV:MIMETYPE}]

The condition looks completely unnecessary, which makes me think you'd benefit
from discussing your config, with a rewritelog, on the users list.


> 
> But it doesn't work anymore.
> 
> According to your explanation above, the last rule should not lead to a
> internal redirect because it changes nothing but the mimetype like the previous
> one. But they behave quite differently!

It could be failing to do what you want for any number of reasons.  Primarily,
you need to make sure that T= rule runs in a round of rewrite processing that
on the whole does not do a substitution -- not just in the one rule with the
T=.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message