• My icons have stopped showing since updating to PHP 7.2
    I use a plugin to run a staging site and the icons still work there.
    I get the “unsafe attempt to access…” “XMLHttpRequest cannot load” CORS error that others have posted on here and I don’t understand how to fix it.

    Can someone kindly explain how I can fix it (what file to access, what code to add, etc).

    Many thanks.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey Fatim,

    So this issue is caused when an asset is being called from a domain name that is different from the domain name the site is serving over. In this particular case the asset is the symbol-defs.svg and that asset is currently being called over the https://www.tilgoldenbrown.com, which is considered to be a different subdomain than the root domain your site is currently serving over, https://tilgoldenbrown.com, it may seem like a trivial difference but the computers are very iterate in their interpretation of rules, particularly CORS or Cross Origin Resource Sharing rules.

    There are two methods you can use to go able solving this. One is to replace all references of https://www.tilgoldenbrown.com to tilgoldenbrown.com, in both your file tree and in your database. This method takes a bit of work as you will need to track down those file calls.

    The second method is to modify your Cross Origin Resource Sharing rules to allow your site to load resources for url’s outside of your root domain tilgoldenbrown.com. In order to do this you can simply add a line of code to your .htaccess file in the root of your wordpress site file tree. The line of code you will need to add is this:

    Header add Access-Control-Allow-Origin "*"

    You can add this ^ line to the top of your .htaccess file and this should resolve the issue. Be sure to clear your caches after applying this change and reload the site in an incognito browser to insure you aren’t getting any browser cached results.

    If this doesn’t do the trick let me know and I can take a 2nd look over the issue.

    Thread Starter fatim.a

    (@fatima-1)

    Hi there, thank you for replying. I added the snippet of code to the top of my .htaccess but it didn’t work.

    This is what it currently looks like

    Header add Access-Control-Allow-Origin "*"
    
    RewriteEngine On
    
    # REDIRECT HTTP to HTTPS
    
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    # REDIRECT WWW to nonWWW
    
    RewriteCond %{HTTP_HOST} ^www\.tilgoldenbrown\.com [NC]
    RewriteRule ^(.*)$ https://tilgoldenbrown.com/$1 [L,R=301]
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteBase /
    RewriteRule ^index\.php$ - [L] 
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    Is there something wrong with my code?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Icons not showing on live site’ is closed to new replies.