Redirect www to non www with subfolder and links
<p>Ok, so i want to redirect all www to non www link,</p>

<p>I want to redirect www.example.com to example.com, and i can do that too using this code.</p>

<pre><code>RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
</code></pre>

<p>But when someone try to access www.example.com/example, that redirects the site to example.com,</p>

<p>I want a code that can redirect www.example.com/example or any subfolder to example.com/example or any subfolder.</p>

<p>Kinda like a wildcard entry, how to do that?</p>

<p>Also if possible force ssl on it too.</p>

<p>Thank You.</p>