Latest news from 5wire Networks

HTTPS redirect Apache – Direct your website users with your htaccess

If you have an SSL Certificate on your website, you can automatically HTTPS Redirect Apache for your visitors to ensure their connection communication is encrypted.

GeoTrust SSL Certificates Comodo SSL Certificate Symantec SSL Certificates

HTTPS Redirect with Apache

You will need to create or modify the .htaccess file. If you currently do not have one, you can create one using your control panel’s file manager.

Add the following code to your .htaccess file:


RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteCond %{HTTP_HOST} ^(www.)?yourdomain.com$ [NC]
RewriteRule ^$ https://www.yourdomain.com/%{REQUEST_URI} [R=301,L]

You will need to replace yourdomain.com with your domain. If you are using http:// without www. in your platform, then remove www. from the code.

If you already have code in your .htaccess file, it is important that you place the above code at the beginning otherwise you will cause unnecessary loops which will cause 404 errors.