Forum Moderators: phranque
Trying to implement a recommendation from google's page speed tool to serve static resource from a separate domain.
I've been using a subdomain off of my main domain for this for a while, only to discover cookies are still being sent with images and things.
Anyways - According to google this is what to do:
"register a new domain name and configure your DNS database with a CNAME record that points the new domain to your existing domain A record. "
That's where I get lost. I know how to mess around with my DNS records a little bit, but I'm kind of confused.
Where do I point the new domain to? I can create a CNAME record that points to the site's domain A record but then where should the new domain's A record be pointing to?
For example I have site.com which is the main website, and site.net which will serve images.
I tried setting up the DNS but think I have done something incorrectly, because when I type in site.net, it just re-directs me to site.com.
According to the live headers extension, it returns a status 200 but not a 301 - which worries me that maybe I'll start running into dupe content or other random issues.
Can anyone break this down for me a little?
Thanks!
You can use
images.example.com and either use an A record or CNAME - but the details depend on how you set up your image server.
In terms of performance, you're not going to gain much of the resources are on the same server, as in reality you're not reducing the server load. You can use one of the "cloud" providers to get a subdomain
something.theirdomain.tld (lots of other hosting companies offer something similar) then you can have a CNAME for "i" which points to that other subdomain.
If the cookies are defined to apply to all subdomains, then the client will send them with any request to *.example.com.
Cookies are sent based on URLs, and the client has no knowledge of physical servers, documentroots, or 'filepaths'.
If your cookie is defined with "path=/; domain=.example.org;" (note the leading period) then it will be sent with all subdomain requests and all resource requests. If defined as "path=/; domain=www.example.org;" then it will be sent only with "www" subdomain requests and all resource requests.
Jim
[edited by: jdMorgan at 12:34 am (utc) on Jan. 31, 2010]