Comprehensive domain mapping for Big Cartel stores

When working with the Big Cartel ecommerce platform it is common to map a custom domain to your store. For example, you might like to use the domain mysite.com instead of your default Big Cartel subdomain mysite.bigcartel.com.

Big Cartel provide instructions for configuring domain mapping using a CNAME record, so that www.mysite.com becomes an alias for mysite.bigcartel.com. This works great except for one thing: if a customer omits the www prefix from your store’s URL they will get a big fat 404 error. This is because your CNAME record only matches the www subdomain.

As far as your web host is concerned, mysite.com (no www) still points at your public web directory, not your Big Cartel store. In fact, it would be possible to set up two entirely separate websites, one at Big Cartel (www.mysite.com) and one at your web host (mysite.com). Eek!

So what can you do if you want your customers to be able to use both www.mysite.com and mysite.com to access your Big Cartel store? It turns out that you have to redirect traffic from mysite.com to www.mysite.com. Unfortunately Big Cartel’s only suggestion in this respect is to:

Contact your DNS host for help setting this up.

Not terribly helpful.

With a little trial and error I discovered that it is actually very simple to set up the redirect using Apache .htaccess directives. My solution is to place an .htaccess file in your site’s root level directory which matches all requests for mysite.com, and appends a www prefix:

RewriteEngine on
Options FollowSymlinks
rewritecond %{HTTP_HOST} ^mysite.com$ [nc]
rewriterule ^(.*)$ http://www.mysite.com/$1 [R=301,nc,L]

Remember to change mysite.com in the example above to your actual domain.

What about static assets?

When developing a Big Cartel store it is common to host your theme’s static assets on a remote server. This is because Big Cartel doesn’t provide a facility for hosting static files such as javascript libraries, web fonts, theme images and so forth. Observant readers will notice that our .htaccess file makes it it impossible to host static assets at mysite.com, since all requests are immediately redirected to mysite.bigcartel.com. You could get around this by creating an “assets” directory at mysite.com, and modifying the .htaccess rewrite conditions to exclude that directory, but I think it is cleaner to set up a subdomain specifically for the purpose of hosting your theme’s static assets, something like assets.mysite.com. You should be able to create this subdomain via your hosting Control Panel.

Caveats

My solution assumes that mysite.com is a fully hosted domain, including a public web directory in which to host an .htaccess file. If you have DNS hosting, but no web hosting, then this obviously isn’t going to work for you.

4 thoughts on “Comprehensive domain mapping for Big Cartel stores

  1. Amin says:

    BigCartel is usually extremely awesome when it comes to support, but it also depends a little on who’s replying to your ticket. I’ve emailed literally 30+ times with them.

    Thanks for the info blogpost though. I want http://trashness.com to load our webshop, withour redirecting to http://www.trashnesss.com. Is that even possible? Any thoughts are welcome. Thanks!

  2. Jonathan says:

    @Amin It’s not possible using a CNAME, since CNAMEs only work on subdomains (in the case of my example, www is the subdomain.)

    You’d need to use some sort of domain alias, so that mysite.com is an alias for mysite.bigcartel.com, but I don’t know if many (any?) hosting providers support that. I don’t believe it’s possible in cPanel, for instance – the closest cPanel has is parked domains, which can only point at your primary hosted domain.

  3. Amin says:

    @Jonathan
    We have our CNAME set up in cPanel. I thought it was impossible as well. But yesterday I convined a HostGator chat agent to fix my desired redirect+cname for me. I literally chatted up 3 times, the first two agents told me it wasn’t possible.

    If he’s right, the www should redirect to non-www ‘after propagation time is complete’, and it ‘ll show our bigcartel shop. Let’s see what happens :D

  4. Jonathan says:

    @ Amit Very interesting! Well I hope you get it working the way that you want.

Comments are closed.