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?
In order to redirect a user to another page, you can use:
if(window.location.host === 'www.example.com') {
window.location = "http://example.com";
}
or for IE only:
window.navigate("http://www.example.com");
there are a few ways to tackle this:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.