Wednesday, February 1

Tag: redirect from http to https

PHP, Web Tricks

How to redirect http to https in wordpress using htaccess

Today I faced a very simple issue and I am going to share that with all of you. In general when we move our wordpress site from Http to Https then we simple change urls in Wordpress->Settings->General.But still if any user is going to open your site with http then it will show in http and that's very bad for you site ranking. For an example my site is on SSL and url is as below:https://phpinfo.inNow when you will try to open below urls then you won't redirect on https automaticallyhttp://phpinfo.in phpinfo.inIf https:// is not in the prefix, the HTTP link loads instead. To overcome this issue you just need to add the following into your .htaccess in between the tag:RewriteCond %{HTTPS} !=on RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]If there were no add...