[users@httpd] [mod_rewrite] Content-type doesn't change, logs say otherwise

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



List,

I've run across a strange problem. I want to serve .html files with
application/xhtml+xml for selected browsers and as text/html for others.
Therefore, I've included these rules in my .htaccess file:

RewriteEngine on
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml
RewriteCond %{HTTP_ACCEPT} !application/xhtml\+xml\s*;\s*q=0
RewriteRule \.html$|/$ - "[T=application/xhtml+xml;charset=utf-8]"

The rule matches urls ending with / as well because directory urls
mapped to index.html were not covered otherwise. However, the dir/ urls
are still unconditionally served as text/html even though the rewrite
log says something else:
195.150.76.4 - - [28/Apr/2006:23:18:01 +0200] [sphinx.tcs.ii.uj.edu.pl/sid#81883d8][rid#8200d00/initial] (3) [per-dir /home/michal/public_html/] strip per-dir prefix: /home/michal/public_html/SZPI/ -> SZPI/
195.150.76.4 - - [28/Apr/2006:23:18:01 +0200] [sphinx.tcs.ii.uj.edu.pl/sid#81883d8][rid#8200d00/initial] (3) [per-dir /home/michal/public_html/] applying pattern '\.html$|/$' to uri 'SZPI/'
195.150.76.4 - - [28/Apr/2006:23:18:01 +0200] [sphinx.tcs.ii.uj.edu.pl/sid#81883d8][rid#8200d00/initial] (4) RewriteCond: input='text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5' pattern='application/xhtml\+xml' => matched
195.150.76.4 - - [28/Apr/2006:23:18:01 +0200] [sphinx.tcs.ii.uj.edu.pl/sid#81883d8][rid#8200d00/initial] (4) RewriteCond: input='text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5' pattern='!application/xhtml\+xml\s*;\s*q=0' => matched
195.150.76.4 - - [28/Apr/2006:23:18:01 +0200] [sphinx.tcs.ii.uj.edu.pl/sid#81883d8][rid#8200d00/initial] (1) [per-dir /home/michal/public_html/] force /home/michal/public_html/SZPI/ to have MIME-type 'application/xhtml+xml;charset=utf-8'
195.150.76.4 - - [28/Apr/2006:23:18:01 +0200] [sphinx.tcs.ii.uj.edu.pl/sid#81883d8][rid#8200d00/initial] (1) [per-dir /home/michal/public_html/] pass through /home/michal/public_html/SZPI/

On the other hand, dir/index.html is served the right way while giving
the same output in the log.

I guess that I'm missing here some strange interaction between
mod_rewrite and DirectoryIndex.

I'm using Apache 2.0.55-4 from Debian.

Any help appreciated.

Thanks,
Michal



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux