How to redirect website’s all inner 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. <IfModule mod_rewrite.c>
  2. RewriteEngine On
  3. RewriteBase /
  4. RewriteCond %{HTTPS} !=on
  5. RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  6. # BEGIN WordPress
  7. RewriteRule ^index\.php$ - [L]
  8. RewriteCond %{REQUEST_FILENAME} !-f
  9. RewriteCond %{REQUEST_FILENAME} !-d
  10. RewriteRule . /index.php [L]
  11. </IfModule>

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 *