Code Snippets Library

In this section you will find small snippets of code that you will use over and over for a specific purpose.

A snippet is a programming term for a small region of re-usable source code, machine code, or text. Ordinarily, these are formally defined operative units to incorporate into larger programming modules.

Article Index:

How do I redirect www to non-www or vice versa or redirect http site wide to https?

People often ask what they should put in their .htaccess file to redirect www urls to non-www, or vice versa. They also frequently ask how to redirect all the http pages on a website to https, which makes  your pages safer, and is what Google prefers these days.

Doing this is also good for your search engine rankings because it combines your Page Ranking factors into one page.