Search code examples
.htaccess

Header set Access-Control-Allow-Origin "*" is not working and icons are not showed up


<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
</IfModule>

this code inside .htaccess file but still icons are not showed up in website. I checked everythink.

also i have on the top of index.php

header('Access-Control-Allow-Origin: *');

enter image description here

also i see in page headers like that in chrome enter image description here

but icons are still like that

enter image description here


Solution

  • I realized that litespeed caching my .htaccess file so my changes didn't applied. So i disabled litespeed cache inside .htaccess file

    <IfModule LiteSpeed> 
    CacheDisable public /
    </IfModule>
    

    after i realized that i forgot output caches on my views. I closed them by adding

    header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    

    and after all that i put

    <IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "*"
    </IfModule>
    

    in to my .htaccess. And then everything worked fine...