How to Redirect WordPress Website and Internal Pages from HTTP to HTTPS

https to https redirections

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.

php

  1. Options +FollowSymLinks
  2. RewriteEngine On
  3. RewriteCond %{HTTP_HOST} ^.*example\.com$ [NC]
  4. 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.

php

  1. RewriteEngine On
  2. RewriteCond %{HTTPS} on
  3. 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.

php

  1. RewriteEngine On
  2. RewriteBase /
  3. RewriteCond %{HTTPS} !=on
  4. RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  5. # BEGIN WordPress
  6. RewriteRule ^index\.php$ - [L]
  7. RewriteCond %{REQUEST_FILENAME} !-f
  8. RewriteCond %{REQUEST_FILENAME} !-d
  9. RewriteRule . /index.php [L]

About webfriendy

Sumit Malviya | Web developer and Blogger

View all posts by webfriendy →

Leave a Reply

Your email address will not be published. Required fields are marked *