Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a solution on a LAMP server to keep a site cookieless such as "", where static content is served from "", and with rules in place to rewrite requests for "" to "". I am really hoping to avoid setting up a cookieless domain for the static content due to an unanswered SEO concern with regards to CNAMEing to a CDN. Is there a way, (or safe hack), that can be implemented where a second domain such as "" is CNAMEd, aliased, or otherwise used with "" to somehow trick a php application into maintaining state with a cookie dropped on "" therefore keeping all of "" cookieless?

If such a solution is feasible, what implications would exists with regards to SSL and cross-browser compatibility other than requiring users to accept cookies from 3rd party domains and possibly needing an additional SSL to keep the cookie secure?

Thanks in advance to all.

share|improve this question

You can host your static content anywhere. I recommend setting up a CNAME to your static assets so you can have a nice domain like to reference in your code. Regarding and, you should point to your IP and is simply a CNAME that points to

Regarding cookies, I'm not sure I follow your question, but you can set cookies on that will show on any variation of that domain (,

Simply prepend the domain name with a period to have the cookie apply to all subdomains: ""

share|improve this answer
thanks for the reply Erik. what i am aiming for is to keep the cookie valid on only and none of it's subdomains. it's a maximizing performance issue where cookies are currently dropping with every static asset. – jasonspalace Feb 18 '10 at 20:10
You should be able to simply set the cookie without the initial period then. However, this will lock it to that domain. You'll need to do a URL re-write to return a 301 and redirect traffic from to or vice-versa. You can see the three lines you'll need to add to your .htaccess file here, it maps to – Erik Giberti Feb 18 '10 at 21:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.