rewrite from http to https in .htaccess
-
Hi 🙂
I run a WordPress Site (4.9.2) and just activated SSL on the Server and the URL is now https://www.norwegianoutfitters.no
I then found documentation on Internet that I could change the «.htaccess» file to rewrite from http to https.
I also see in documentation found on Internet that I cannot set «RewriteEngine On» twice in the «.htaccess» file“.Here is my «.htaccess» file now after I put in the second part (after # END WordPress):
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule># END WordPress
#Rewrite everything to https
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]The first part in the “.htaccess” must be default from WordPress i think.
The second part I added because I will force visitors to use https.I have also put https (https://www.norwegianoutfitters.no) in Settings > General > WordPress Adress (URL) and the same in Settings > General > Site Adress (URL).
So my questions is:
1)
I wonder if «RewriteEngine On» is considered as twice in my «.htaccess», or is it okay?
If not, what is the right code?2)
No I use «RewriteCond %{HTTPS} !=on» but I also find this code to be used, «RewriteCond %{HTTPS} off».
Which one is right or will both work?3)
Or maybe I don’t have to use «rewrite everything to https» in the «.htaccess» file because I have change the URL’s in WordPress Settings?4)
I also see this «Connection is Not Secure – Part of this page are not secure (such as images)». when I hover the mouse over the padlock icon. What can I do to fix this?Hope someone can help and clarify this.
Kind Regards
Tom LøkkaThe page I need help with: [log in to see the link]
The topic ‘rewrite from http to https in .htaccess’ is closed to new replies.