Code Snippet
Redirect to SSL
window.location = "https://" + window.location.hostname + window.location.pathname + window.location.search;
You might wanna test if window.location.href doesn't start with "https" before doing that, so you don't redirect unless you have to.
Why would use JS instead of PHP? Or .htaccess?
Maybe you’d like it to be triggered by a user event, there’s never only 1 right way to do something
This is what I was using before, although Chris’s way is far better
window.location = window.location.href.substr(0,4) + “s” + window.location.href.substr(4,250);
Don’t forget about
location.hash!You also can use
DigWP
A book and blog co-authored by Jeff Starr and myself about the World's most popular publishing platform.
Quotes on Design
Design, like Art, can be an elusive word to define and an awfully fun thing to have opinions about.
HTML-Ipsum
One-click copy to clipboard access to Lorem Ipsum text that comes wrapped in a variety of HTML.
Bookshelf
Hey Chris, what books do you recommend? These, young fertile mind, these.