• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Gokul Deepak

Gokul Deepak

GoCool and Debug

  • Home
  • WordPress
  • Android
  • How to
  • About Me

How to Redirect http to https://www through .htaccess

August 19, 2017 by Gokul Deepak S Leave a Comment

Redirect http to https://www through .htaccess.

Simply add the code given below in the .htaccess file. The given code will generate only 302 redirect which means a temporary modification to search engines.

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

If you need 301 redirection which is a permanent redirection, simply add the code given below.

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^example\.com [NC] 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]

Do not forget to change example.com to your domain name.

Eg:   example\.com you have to change as gokuldeepak\.com.

Example.com as gokuldeepak.com

Filed Under: How to

Authored by Gokul Deepak S

Leave a Reply Cancel reply

0 Comments
Inline Feedbacks
View all comments

Primary Sidebar

Popular Pages

  • How to find the date of the Facebook group it was created
  • Elementor Plugin and Nginx Configuration
  • Combine two separate files line by line in Notepad++
  • WordPress - Display Ads only on posts not on pages
  • CORS error in Apache Tomcat - Solved
  • How to add ads.txt on Bluehost
  • How to install OwnCloud on Bluehost
  • How to block access to the wp-content uploads folder
  • Home

Archives

Categories

  • Android
  • Apache
  • AWS
  • Blogger
  • Computer Tips
  • DevOps
  • Docker
  • Earn
  • Facebook Tips
  • Git
  • Google Tips
  • Hosting
  • How to
  • Laptop Tips
  • Laptops
  • Linux
  • Mobile
  • MongoDB
  • Nginx
  • Node JS
  • Notepad++
  • PostgresQL
  • Ubuntu
  • Wordpress
  • Xenforo

Tags

Android Android One AWS Bluehost Comparisions Custom ROM Elementor Facebook Genesis Genesis Sample Theme Google Drive How to Lineage OS Notes OnePlus One OwnCloud Rooting Smartphones Stock ROM Studiopress Tomcat Wordpress plugin

Copyright © 2023 · Maintained by GokulDeepak

wpDiscuz