How to Redirect HTTP to HTTPS in WordPress Blog?

QuestionsCategory: WordPressHow to Redirect HTTP to HTTPS in WordPress Blog?
Ankita Patel Staff asked 2 years ago

I recenlty installed SSL Certificate on my website. Now I want to redirect all my user from HTTP links to HTTPs links by deafult. How to do this? Please share the redirect code for redirecting user from HTTP to HTTPS links.

1 Answers
Love U Marketing Staff answered 2 years ago

Just copy and Paster this code to your .htaccess file and it will automatically redirect all HTTP request to HTTPS.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*)?wp-comments-post\.php(.*)$
RewriteCond %{HTTP_REFERER} !^http(s)?://example\.com [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule .* [L]

1. This redirect code needs to be paste in .htaccess file
2. It is for Apache HTTP Server
3. Request you to please check the below artice also. If you have moved your website from HTTP to HTTPS then there will be a decrease in the number of Indexed Page in Google Webmaster. Please refer the below article to know how to resolve it