Andrew McCombe


Full Stack Web Developer

Apache: Use .htaccess to redirect non-www to www

Sometimes your website will be set up to serve your site on both www.domain.com and also domain.com. Search engines will see this as two separate sites (unless you have a rel=”canonical” tag) and this may have a negative effect on your SEO rankings. The best way to avoid this is to make sure you serve […]


Apache: Use .htaccess to redirect http to https

I’m forever having to lookup how to use Apache’s .htaccess to redirect http to https so here it is. First, make sure you have Apache’s mod_rewrite module enabled.

This will check the request for HTTPS and if it matches will permanently redirect the browser to the https:// url.