I just added an SSL certificate to my Wordpress website using this code (.htaccess):
# REDIRECT HTTP TO HTTPS RewriteCond %{HTTPS} !=on RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
However, when I type monersi.pl/something in browser, the certificate doesn't work, but when I type monersi.pl, everything is okay. (monersi.pl is my website)
What did I do wrong?
I just added an SSL certificate to my Wordpress website using this code (.htaccess):
# REDIRECT HTTP TO HTTPS RewriteCond %{HTTPS} !=on RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
However, when I type monersi.pl/something in browser, the certificate doesn't work, but when I type monersi.pl, everything is okay. (monersi.pl is my website)
What did I do wrong?
Share Improve this question edited Apr 13, 2020 at 21:24 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked Apr 13, 2020 at 21:05 kacper3355kacper3355 772 silver badges9 bronze badges1 Answer
Reset to default 1If it's all in one line, it will be commented out at # Redirect HTTP...
as the #
character is used for commenting in .htacces.
Try:
# REDIRECT HTTP TO HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]