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

Gokul Deepak

GoCool and Debug

  • Home
  • WordPress
  • Android
  • How to
  • About Me
Home » How to » How to Redirect http to https://www through .htaccess

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

August 16, 2020 by GokulDeepak 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

Related

Filed Under: How to

Authored by Gokul Deepak S

Reader Interactions

Leave a Reply Cancel reply

Primary Sidebar

Popular Posts

  • How to find the date of the Facebook group it was created
  • Home
  • Downgrade from Lollipop to Kitkat for Micromax Canvas A1 (Android One)
  • How to remove Linux OS in Tamilnadu Government Free Laptop
  • How to block access to the wp-content uploads folder
  • How to add ads.txt on Bluehost
  • Combine two separate files line by line in Notepad++

Recent Posts

  • Can’t connect to Ubuntu with SSH
  • Change Timezone in Ubuntu 20.04 – Simple method
  • Output for timedatectl list-timezones
  • PM2 Cheatsheet – Important Commands
  • MongoDB Terminal commands – Cheatsheet

Archives

Categories

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

Tags

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

Copyright © 2021 · Maintained by GokulDeepak