title: Access-Control-Allow-Origin in .htaccess didnt work in sub directories
body: <p>I have an error when I try to convert image from URL to base 64, the error is</p>
  
  <blockquote>
    <p>Access to image at >'<a href="https://img.blabla.com/user/profile_pict/1541043536539.jpg" rel="nofollow noreferrer">https://img.blabla.com/user/profile_pict/1541043536539.jpg</a>' from >origin >'<a href="http://localhost:4200" rel="nofollow noreferrer">http://localhost:4200</a>' has been blocked by CORS policy: No >'Access->Control-Allow-Origin' header is present on the requested resource.</p>
  </blockquote>
  
  <p>I've tried so much to fix this error, some peope said " You should put <code>Header set Access-Control-Allow-Origin "*"</code> in .htaccess on <code>https://img.blabla.com/</code> ", so I tried put .htaccess, like this. </p>
  
  <p><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
      RewriteCond %{SERVER_PORT} !443
      RewriteRule ^(/(.*))?$ https://%{HTTP_HOST}/$1 [R=301,L]
  &lt;/IfModule&gt;</code></p>
  
  <p><code>&lt;FilesMatch "\.(gif|png|css|js|jpg)$"&gt;
      &lt;ifModule mod_headers.c&gt;
        Header set Access-Control-Allow-Origin "*"
        Header set Access-Control-Allow-Methods: "*"
        Header set Access-Control-Allow-Headers: "Origin, X-Requested-With, Content-Type, Accept, Authorization"
      &lt;/ifModule&gt;
  &lt;/FilesMatch&gt;</code></p>
  
  <p>.htaccess just works in <code>/index.html</code>. it didnt works in sub directories. Let say I have a website with this structure:</p>
  
  <p><code>/index.html
  /.htaccess
  /user/profile_pict/*.jpg
  /travel_agent/trip/*.jpg</code></p>