Redirect your website to fully https verison by simply added a code in website’s configuration file or .htaccess file.
HTTP to HTTPS :
Simply adding a code in your .htaccess file in root folder.
This code is redirect your domain to https verison.
- Options +FollowSymLinks
- RewriteEngine On
- RewriteCond %{HTTP_HOST} ^.*example\.com$ [NC]
- RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L][/php]
this code is completely redirect your website’s all pages from http version to https with 301 permanent redirection which is preferred for seo prospective.
- RewriteEngine On
- RewriteCond %{HTTPS} on
- RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Here is the complete look of .htaccess file for redirecting home page and it’s all internal pages of website.
- <IfModule mod_rewrite.c>
- RewriteEngine On
- RewriteBase /
- RewriteCond %{HTTPS} !=on
- RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
- # BEGIN WordPress
- RewriteRule ^index\.php$ - [L]
- RewriteCond %{REQUEST_FILENAME} !-f
- RewriteCond %{REQUEST_FILENAME} !-d
- RewriteRule . /index.php [L]
- </IfModule>