Search code examples
javascripthttp-redirecturl-rewritingdivshot

Redirect all domains requests to 1 domain without `www.` on Divshot


Kicking the tires on divshot.com with my middleman blog. I moved it over from Heroku, which uses rack to handle URL redirects/rewriting. I'm trying to duplicate some of that behavior on divshot, which uses HTML5 pushState (superstatic) instead.

I have multiple domains that I want to redirect to 1 domain, and I want to redirect all www. requests directly to http://example.com (rather than http://www.example.com).

Is there anyway to do this?


Solution

  • there are a few ways to tackle this:

    1. Your DNS provider may offer the ability to make these kinds of redirects without having to use Divshot to do it.
    2. If you have a high-performance app (i.e. a paid plan) we can manually configure our CDN to do those redirects for you.
    3. You can detect host in JS and redirect that way (less ideal, I'd go with 1 or w).