How to Redirect HTTP to HTTPS in WordPress Blog?

QuestionsCategory: WordPressHow to Redirect HTTP to HTTPS in WordPress Blog?
Avatar for Ankita PatelAnkita Patel Staff asked 1 year 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
Avatar for Love U MarketingLove U Marketing Staff answered 1 year 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_METHOD} POST
RewriteCond %{REQUEST_URI} ^(.*)?wp-comments-post\.php(.*)$
RewriteCond %{HTTP_REFERER} !^http(s)?://example\.com [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule .* http://127.0.0.1 [L]
</IfModule>

Note:
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
https://loveumarketing.com/dropping-indexed-pages/

Your Answer

10 + 3 =