Created
April 13, 2022 08:36
-
-
Save akhileshdarjee/425e7158fe3004a46d9e6228f15528f9 to your computer and use it in GitHub Desktop.
Let's Encrypt - Redirect everything to HTTPS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Let's Encrypt(Certbot) redirect everything to HTTPS: | |
1. Run the following command | |
certbot --apache -d yourdomain.com -d www.yourdomain.com | |
2. Navigate to your domain Apache2 conf file and scroll to the bottom. You'll see something like this: | |
RewriteEngine on | |
RewriteCond %{SERVER_NAME} =www.yourdomain.com [OR] | |
RewriteCond %{SERVER_NAME} =yourdomain.com | |
RewriteRule ^ %{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] | |
From the above code replace the following line: | |
RewriteRule ^ %{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] | |
with | |
RewriteRule ^ https://yourdomain.com%{REQUEST_URI} [END,NE,R=permanent] | |
Note: | |
Replace 'yourdomain.com' with your desired domain |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment