Setting up a redirect in .htaccess

301 redirect (301 Permanent Redirect) – server redirection of the user to another address. Thus, when accessing the old domain address, the user is automatically redirected to the new address.

A server-side 301 redirect is used to transfer the weight of a site and old pages to a new one, or to redirect from www to a non-www address (or vice versa), depending on what you need.

301 redirect is a great way to save your website promotion results and their positions in search engines when you move to a new address.

This 301 redirect method is used in the Really Simple SSL application.

<IfModule mod_rewrite.c>
Rewrite Engine on
RewriteCond %{HTTPS} !=on [NC]
RewriteCond %{REQUEST_URI} !wp-content\/cache\/(all|wpfc-mobile-cache)
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/
RewriteRule ^(.*)$ https://www.site.com/$1 [R=301,L]
</IfModule>