Skip to content

Instantly share code, notes, and snippets.

@MubinSayed
Last active December 16, 2021 19:45
Show Gist options
  • Save MubinSayed/0e05bdd6d1599149b7be87be268f83fa to your computer and use it in GitHub Desktop.
Save MubinSayed/0e05bdd6d1599149b7be87be268f83fa to your computer and use it in GitHub Desktop.
.htaccess redirect http to https
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Successfully redirect all pages of domain from http to https:
# Note this will redirect using the 301 'permanently moved' redirect, which will help transfer your SEO rankings.
# To redirect using the 302 'temporarily moved' change [R=302,L]
# Ref: https://stackoverflow.com/a/27029144
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment