0

This question already has an answer here:

I now manage a Magento 1.9 site and it never had an SSL. Now it needs one.

What sort of internal tools within Magento are there for managing 301 redirects?

Are there any best practices I should know about when transitioning a site to using an SSL when it has been around for 5 years with insecure links.

The site is not used for e-commerce but is simply a catalog.

marked as duplicate by Rakesh Jesadiya, Fabian Schmengler, Keyul Shah, 7ochem, Siarhey Uchukhlebau Mar 31 '17 at 19:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

If you don't change the URLs of the product or category pages, you can solve this in your .htaccess file or Nginx configuration. To solve this, you need to do the following:

Apache (.htaccess)

## Redirect all URLs that are not using HTTPS, to HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Header set Strict-Transport-Security "max-age=31536000" env=HTTPS

Nginx

## Redirect all URLs that are not using HTTPS, to HTTPS
if ( $http_host ~ ^(?!www\.).*){
    return 301 https://www.$host$request_uri;
}

add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";

Using HSTS will make sure that no URLs can be retrieved using HTTP, but will redirect to HTTPS immediately. In the above case, I expect the site to run on www.domain.com. If it's running on the non-www domain, you can remove the checks for www.

If you did change the URLs of product and category pages, you can use Magento's internal URL rewrite system. This can be found in the Magento backend under Catalog > URL Rewrite Management.

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