Whats the best way to redirect http to https on wordpress?

Mountainsforever

Junior Member
Joined
Dec 30, 2022
Messages
107
Reaction score
84
Im guessing there are plugins that do this but would it be better to add it to the htaccess file for pagespeed or some other way Im not thinking about or dont know about?

Thanks
 
I only recommend htacess


RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
 
After you set up the HTTPS version of domain in Cpanel, I guess wordpress will become https version automatically isn't it?

But if you enable SSL certificate after building the website, you can change HTTP to HTTPS in wordpress dashboard settings, then website will become https version, then you have to set up some 301 redirection rules, to let all versions like www.domain.com http://domain.com http://www.domain.com all redirect to your main version: https://www.domain.com or to https://domain.com

This redirection setting I guess all hosting provide has this feature in their Cpanel, please ask their support.

Typically, this question can be solved by support, you don't need to do it yourself.
 
Htaccess is the easy enough, you really don't need a plugin for this one,
Just ensure to have both redirects enabled for CDN and server side if you're using cloudflare
 
Back
Top