Magento – Htaccess – How to i make this redirect a 301 instead of 302

.htaccess301-redirectredirecturl-rewrite

My website redirects everything from http to https but 1 of the redirects is a none cacheable 302 redirect according to a few seo checkers i use.

How can i get the following code to be a 301 redirect instead of a 302?

    Options +FollowSymLinks
    RewriteEngine on

RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^lincoln-printing-services\.co\.uk$ [NC]
RewriteCond %{HTTP_HOST} !^www\.lincoln-printing-services\.co\.uk$ [NC]
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteRule ^index\.php$ - [L]

Best Answer

Try appending [R=301] to your RewriteRule entries. If you have existing parameters (like [L]), comma-separate them: [R=301,L].

Related Topic