views:

374

answers:

4

Bizarrely my javascript and css files have cookies (says Firebug). I use Zend Framework and I think it has to do with it. Could I change the .htaccess that CSS or JS files don't link to the ZF or is there another solution?

.htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

In my bootstrap file I start the session automaticly, could I detect there really existing files and deactive sessions/cookies?

+4  A: 

Cookies aren't in js or CSS files: they are transferred over the HTTP headers.

You can minimize the space they take but if you rely on them, you can't really get rid of them. You can always "move" the static files someplace else so you don't incur the "cost" of the additional headers e.g. cookies. Other place being --> other domain where you suppress cookies altogether.

jldupont
OP: only uour browser has cookies, not the individual files. however, cookies are transferred in the HTTP headers if they exist during the transfer of individual files
dusoft
Yes, that's right, the HTTP header send the cookie, I have dedicated myself.
+1  A: 

Cookies are set per domain, so the browser will send them along with every request it makes to that domain, regardless what type of resource it is requesting.

Pekka
A: 

You can place your CSS and JavaScript files and your Images on a "static" webserver or subdomain which does not accept cookies. There are two very good explanations out there:

powtac
That is it what I mean. But could I set "no cookie sending/accepting" for all files in a separated folder (with a .htaccess in it)?
No you can not. Cookies are sent by the browser and if he has a cookie set by a site he will send a cookie with every request to the domain that set the cookie.
Goran Jurić
A: 

It seems there is a way :

Header unset Set-Cookie
Vincent Clair