Since 2 weeks I have installed an SSL certificate on my domain. I have changed my base urls to https so my canonical url is https now. But now I need to force to https. I did this with the below htaccess change, but if I update my permalinks in admin now, Wordpress overwrites it to the old htaccess and my https redirect is gone.

Has anyone any experience with this?

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{SERVER_NAME}/dev/$1 [R,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

1 Answer 1


You have to modify either before # BEGIN WordPress or after # END WordPress. This part is modified by WP, once you change your permanlink

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.