After installing Let’s Encrypt on Ubuntu with Apache for a WordPress site, Let’s Encrypt asked to select to add a redirect (option 2) to what I said yes, because this was for an existing site that was on HTTP.
Then checking the 000-default.conf file these lines where added:
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com [OR]
RewriteCond %{SERVER_NAME} =www.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
My question: Is above lines the same and these other lines below:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
I’m asking because, I’ve found this interesting article from Yoast.com, known for its SEO plugin for WordPress: https://yoast.com/moving-your-website-to-https-ssl-tips-tricks/ and it recommends to add a 301 redirect in default VirtualHost configuration to properly switch to from HTTP to HTTPS.
Also, long time ago I had some weird URL structure and later on I switch to example.com/post-name structure to make the switch I had to add this redirect line to my htaccess files:
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(?!page/)(.+)$ http://example.com/$4
The question is: after adding the correct HTTP to HTTPS redirect to the VirtualHost file will I have any conflicts with the RedirectMatch 301 mentioned above?
PS: I’m aware that in the RedirectMatch 301 I’ll have to change the http:// to https:// after installing Let’s Encrypt.