Support » Networking WordPress » Cookieless Domain Help

  • Hi guys,

    I’m trying to set up a subdomain as a cookieless domain to serve various static files in my theme. I’m trying to figure out how to do this using Dreamhost, but at the same time I’m a bit confused because of my setup.

    I’m using W3 Total Cache with a CDN that uses Amazon S3 and Cloudfront. All this on a multisite WP installation.

    I’ve already created the subdomain itself on dreamhost, but I don’t know where else to go after that. A little guidance would be much appreciated 🙂

    Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • You’ll need to create a cname DNS record for the subdomain (cdn.domain.com) and point it to your cloudfront CDN URL.

    Thread Starter astromono

    (@astromono)

    Thanks for your reply, Patrick! 🙂

    I’m assuming, once the subdomain points to my CDN URL (a separate one from the “main” I use for w3tc), I should like the cloudfront distribution to the s3 bucket that has the static files. Is that correct?

    Thread Starter astromono

    (@astromono)

    Hm. I tried creating a cname DNS record for the subdomain I created on dreamhost, but It’s not allowing me to do it.

    I have created DNS records before, but only on the main domain (astromono.com), but this time when trying it on a subdomain I get the following error:

    You already have a record for this name. You can't have a CNAME and any other record on the same name.

    Apparently, dhost doesn’t allow me to just leave the name of the DNS record as “cdn.astromono.com”, requiring me to enter something before the subdomain URL (i.e. something.cdn.astromono.com). Will that work?

    Mika Epstein

    (@ipstenu-dh)

    DreamHost Rep

    You’re trying to edit the DNS for astromono.com right?

    I just tested on my account and I can add a subdomain of CDN.

    Name: cdn

    Type: CNAME

    Value: cdn-test.domain.com

    What values were you using?

    Thread Starter astromono

    (@astromono)

    I’m using the following values on a subdomain named “cdn.astromono.com”:

    Name: I’m leaving it blank for “cdn.astromono.com” (as per instructions on the dhost page there)

    Type: CNAME:

    Value: “www.astromono.com”

    I’m now quite certain I’m doing it wrong, since I created the subdomain and I’m trying to input this information on the subdomain DNS. I’m assuming I should be adding this info in the actual domain, am I correct?

    Thanks for your help, Mika. You’re like a caped crusader with hyper-patience superpowers!

    Thread Starter astromono

    (@astromono)

    Also, I found this information regarding using subdomains as cookieless domains:

    If your website uses the root domain (example.com as opposed to http://www.example.com ,for instance) to serve traffic and uses Google AdSense, you cannot make a cookieless domain as a sub-domain and MUST use an alternative domain name. The reason for this is that the Google AdSense code sets cookies on the requested domain and all sub-domains. They do not allow you to override this behavior.

    If my FTP is anything to go by, my domain root points to astromono.com instead of http://www.astromono.com, so I guess I need a separate domain to store my static files.

    Mika Epstein

    (@ipstenu-dh)

    DreamHost Rep

    I’m now quite certain I’m doing it wrong, since I created the subdomain and I’m trying to input this information on the subdomain DNS. I’m assuming I should be adding this info in the actual domain, am I correct?

    Yeah, that’s where you went bibbeldy 🙂

    Delete the subdomain. Then go edit the DNS for the main domain and add it there.

    Thread Starter astromono

    (@astromono)

    Thank you for clarifying that!

    Once it’s been added, what should I do? Say instead of making the CNAME point to http://www.astromono.com I make it point to a distribution on amazon cloudfront. Should I do any edits to the wp-config.php afterwards?

    Mika Epstein

    (@ipstenu-dh)

    DreamHost Rep

    IIRC it’s adding in this:

    define('COOKIE_DOMAIN','astromono.com');

    but I’m not 100% sure that works the way you want it to.

    Thread Starter astromono

    (@astromono)

    Oh man. I don’t know if that works the way I want it to either! Now I’m anxious!

    The point of the cookieless domain is to lower http requests to the server so astromono.com will load faster. I’ll test it and then we’ll see how it goes. Man… this is scary

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Cookieless Domain Help’ is closed to new replies.