How to Force SSL (HTTPS) with .htaccess Print

  • SSL, security
  • 0

The .htaccess file resides at the root of every website and subdomain. It defines rules for how pages are served to a browser. While Farmer Host provides basic SSL, By default, the pages are served via an insecure (http) connection unless the .htaccess file is modified. To ensure visitors view the secure version of your website, you want to add a rule that redirects any http URL to https.  You can create or edit the .htaccess file either via FTP, or using the File Manager available in your cPanel.

 

Add the following six lines of code to your .htaccess file to force SSL.

 

# Redirect all website visitors to use ssl

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteCond %{HTTPS} off

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

</IfModule>

 

The .htaccess file needs to be located inside the site's document root folder. If your website is in a sub folder, then the .htaccess should be placed in the corresponding sub folder.

 

Conclusion

 

SSL protects the information in transit, allowing a website to be accessed over HTTPS. The data is sent encrypted between visitors and web servers. Forcing the secure URL to be loaded helps secure data transmission, gives visitors greater confidence that your website is safe to visit, and boosts site ranking in search engines like Google. If you have questions about the basic SSL security that Farmer Host provides for no extra charge, or are interested in assistance securing your site, don't hesitate to contact us. We're here to help.

 

Just remember, having an HTTPS WordPress website does not mean the website is protected against website attacks and hacks. It is one important piece of the website security puzzle.


Was this answer helpful?

« Back

Powered by WHMCompleteSolution