Forum Moderators: phranque

Message Too Old, No Replies

Header unsets being ignored on files who are internally rewritten

         

jboy

10:46 pm on Feb 3, 2011 (gmt 0)

10+ Year Member



I have an internal rewrite in a .htaccess which does this (this is on a subdomain, just incase that effects things):

subdomain.domain.com/dir/file.css -> subdomain.domain.com/dir/file.css.php

and the rewrite is in:

subdomain.domain.com/.htaccess

and is:

RewriteEngine On
RewriteRule ^([^.]+)\.css$ /$1.css.php [NC,L]


Now, in this

subdomain.domain.com/dir/.htaccess

I have:

Header unset Content-Location
Header unset TCN
Header unset Vary


but on accesses to
http://subdomain.domain.com/dir/file.css

the Header unsets are being completely ignored. If I access the file by
http://subdomain.domain.com/dir/file.css.php

the Header unsets work. Any idea how to get it so the unsets are applied to
http://subdomain.domain.com/dir/file.css
accesses?

Thanks.

I've just had a further thought: maybe the headers Content-Location, TCN, Vary aren't appearing when I access the file by using
http://subdomain.domain.com/dir/file.css.php
not because of the .htaccess file, but because those thing don't apply in the case where a rewrite hasn't occurred?

Much confused.

jdMorgan

8:32 pm on Feb 7, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are these Header Unset directives enclosed in any kind of <Files> or <FilesMatch> container? If so, then the pattern in the container must match ".css.php" since that is the real filename on the server.

It is also possible that the server config is overriding your Header Unset, or that your .php scripts are outputting the header after your code case un-set it.

Jim

jboy

8:56 pm on Feb 7, 2011 (gmt 0)

10+ Year Member



No they weren't enclosed by <Files> or <FilesMatch> but as I just said in another post, the headers issue has been sorted in a better way than unset now; MultiViews was causing those headers, so Options -MultiViews turns off MultiViews including those unwanted headers, so this is kind of what was happening in a way:

> It is also possible that the server config is overriding your Header Unset

Thanks.