Redirect the site url http to https..for this i upload .htaccess file in my cpanl public_html root directory.the code of the file as
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://sitename.in/$1 [R,L]
After i hosted this file also it's not redirecting my site to https protocol
i am writing this answer too late but currently its working fine. So try to do it on your root directory .htaccess file.
# Force SSL
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
Note: It will work only if you have mod_rewrite
installed on cpanel server, otherwise use php bases SSL redirect.
I just modified the .htaccess file in the first part of the answer for my Wordpress site to redirect http:// to https://. I didn't need to modify the index page and it worked fine for me without it. Thanks to the author of that as it completed my quest for a secure certificate migration.
My complete file .htaccess file looked like this for me. I suggest making a local copy as I broke my site a few times before I found the right answer for me here:
#RewriteCond %{HTTP_HOST} ^yoursite\.com [NC]
#RewriteRule (.*) http://www.yoursite.com/$1 [R=301,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Options +FollowSymlinks
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yoursite.com/$1 [R,L]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With