I have a Wordpress site functioning as a blog site on a website. The main website is just basic HTML it is only www.example.com/blog which has the WordPress site.

I have installed an SSL certificate for the domain and it is working fine. I have a .htaccess file in the root folder redirecting from HTTP to https for the main site and another in the /blog folder redirecting the Wordpress site.

The problem I am having is the main folder www.example.com/blog will redirect to https however none of the blog posts will redirect.

So for example if I enter http://www.example.com/blog into the browser i get https://www.example.com/blog.

But if I enter http://www.example.com/blog/blog-post I get http://www.example.com/blog/blog-post it does not redirect.

I have tried a number of different .htaccess commands, but they all give the same result. I currently have the following script in the .htaccess folder.

RewriteEngine on 
RewriteCond %{HTTPS} !=on [NC] 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Any help on this would be greatly appreciated.

2 Answers 2


You should set your blog url to https://yourdomain.com You can do this in the /wp-admin/options-general.php page the setting is WordPress Address (URL) and Site Address (URL)

  • Hi Nathaniel, thank you for the feedback. I did make this change when I switched to HTTPS. But it did not make a difference.
    – Pete B
    Commented Apr 25, 2020 at 9:31

So I finally got it working, the solution was quite simple and I am not sure why it made a difference. but I am not an expert so maybe someone else can weigh in on it at some stage.

Basically I just moved the Rewrite rule in the .htaccess file to the top. There are a few other rules in the file and originally it was below the others.

The code I ended up using that has worked when placed at the very top of the .htaccess file is:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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