Skip to content

Instantly share code, notes, and snippets.

@mdmoinulhossain
Created December 26, 2022 11:07
Show Gist options
  • Save mdmoinulhossain/583abc77fffe819fdff70713ad549465 to your computer and use it in GitHub Desktop.
Save mdmoinulhossain/583abc77fffe819fdff70713ad549465 to your computer and use it in GitHub Desktop.
Redirect any website HTTP to HTTPS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment