302 redirect instead of 301 after switch to HTTPS

by Marc   Last Updated September 01, 2017 15:08 PM

Last week I changed my website from HTTP to HTTPS.

Despite the 301 redirect rule in .htaccess, all old (HTTP) pages are redirected with a 302 redirect for some reason. I cannot find what this is and did not change any plugins at all. The only thing I created was an extra rule in .htaccess.

Here is an overview of my .htaccess file:

<IfModule mod_rewrite.c> 
RewriteEngine On 

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

RewriteBase /

RewriteRule ^index\.php$ – [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

However, currently, I only see 302 redirects when checking all the pages. How can I make sure that a 301 redirect will be in place instead of a 302 redirect?

Related Questions

htaccess https redirect from www to non-www

Updated June 16, 2017 04:08 AM

https redirect (with .htaccess) redirect loop

Updated August 08, 2016 08:03 AM

Removing redirect chain created by Cloudfront CDN

Updated August 12, 2016 08:05 AM

some url does not redirect from http to https

Updated June 22, 2018 08:08 AM