WordPress & Full-stack development

Did you just migrate a WordPress website to another server and now all your Font Awesome icons are suddenly broken? I know how you feel!

After migrating about 25 WordPress websites to new servers, I noticed that there were little cubes where there should have been icons:

A quick look at the browser console tells us that there's something wrong with the CORS rules:

No 'Access-Control-Allow-Origin' header is present on the requested resource

To fix this issue, you'll need to open up the virtual host file on your NGINX server (on Laravel Forge, simply go to your site, click on 'Edit files' and choose 'Nginx configuration file) and add this line:

location ~* \.(eot|css|otf|ttf|woff)$ {
  add_header Access-Control-Allow-Origin *;
}

You can simply put it under the existing location line. In my case it looks like this:

Then it's just a matter of restarting your NGINX server and the icons should appear again!

You’ve successfully subscribed to Teebow Dev Blog
Welcome back! You’ve successfully signed in.
Great! You’ve successfully signed up.
Success! Your email is updated.
Your link has expired
Success! Check your email for magic link to sign-in.