How to Redirect All HTTP to HTTPS .htaccess

How to Redirect All HTTP to HTTPS .htaccess

by admin

If you have installed an SSL certificate on your website, the website may not be available via a secure HTTPS connection by default.

In this case, you need to redirect your visitors to the secured (HTTPS) version of your site. There are some way to redirect HTTP to HTTPS but we share only one way about it.

You need to insert the following lines of code in the .htaccess file.

# BEGIN Redirect HTTP to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
# END Redirect HTTP to HTTPS

Related articles

Placeholder Image
How to Show Clean Cache Button at the Toolbar to the Authors

https://www.wpfastestcache.com/features/clear-cache-link-at-the-toolbar/

Create a Post Cache by ID Using the Function Hook
Create a Post Cache by ID Using the Function Hook

This function is designed for manually creating page caches.

Placeholder Image
Image Slider and Render-blocking JavaScript

Google recommends to load the JavaScripts after html, css and images.

Ready to get started?

Purchase your first license and see why 1,500,000+ websites globally around the world trust us.