title: Redirect http to https and www to non-www in .htaccess
body: <p>First of all, I know there are lots of answers on this, but I don't actually find one that works. This is what I have in the <code>.htaccess</code> file right now, and I want to mention that it worked previously, but it does not anymore.</p>
  
  <pre><code>Redirect 301 /unt-de-cacao-de-plaja/filtre/producator/crisnatur/ /ingrijire-corporala/unt-cacao/unt-de-cacao-pentru-plaja-100g
  
  Options +FollowSymlinks
  
  # Prevent Directoy listing
  Options -Indexes
  
  # Prevent Direct Access to files
  &lt;FilesMatch "(?i)((\.tpl|\.ini|\.log|(?&lt;!robots)\.txt))"&gt;
   Require all denied
  ## For apache 2.2 and older, replace "Require all denied" with these two lines :
  # Order deny,allow
  # Deny from all
  &lt;/FilesMatch&gt;
  
  # SEO URL Settings
  RewriteEngine On
  # If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
  
  RewriteBase /
  RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
  RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
  RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
  RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
  
  # FORCE HTTPS AND NON WWW
  RewriteEngine on
  
  RewriteCond %{ENV:HTTPS} !on
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  
  RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
  RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
  </code></pre>
  
  <p>As a mention, I will have a lot of Redirect 301 from old pages to the new ones since the entire structure has been changed.</p>
  
  <p>And the links that I am redirecting inside my website come with "www" like:</p>
  
  <pre><code>https://www.example.com/unt-de-cacao-de-plaja/filtre/producator/crisnatur/
  </code></pre>
  
  <p>and needs to be redirected to:</p>
  
  <pre><code>https://example.com/ingrijire-corporala/unt-cacao/unt-de-cacao-pentru-plaja-100g
  </code></pre>