4 min read Domains & DNS

What is .htaccess?

.htaccess is a configuration file that lives in your site's root folder and controls things like redirects, custom error pages and security rules on Apache-based hosting (our Shared and Cloud plans).

Force HTTPS

Once your SSL certificate is active, add this snippet near the top of your .htaccess file to redirect all visitors to the secure version of your site:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Redirecting www to non-www (or vice versa)

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com [NC]
RewriteRule ^(.*)$ https://yourdomain.com/$1 [L,R=301]

A word of caution

Always back up your existing .htaccess file before editing it — a mistake here can take your whole site offline. If you're unsure, message our support team and we'll add the rule for you.

Still stuck?

Our support team can do this with you, live.

Ask on WhatsApp