Skip to main content
Solved

How can I add custom font from cPanel/WordPress server?

  • March 8, 2023
  • 6 replies
  • 376 views

cl4udio
Contributor I
Forum|alt.badge.img+2

Hi Klaviyo’s team/community,

 

Someone know why I can't import my custom font from my Self-Hosted site?

From Shopify servers works fine, but from a cPanel/WordPress/Woocommerce doesn’t it.

I have tested with .woff or .woff2, all the time with all file’s privileges (777) .

 

I can't find info about this issue on your forum.

 

Please, help me.

Thanks in advance.

Best answer by stephen.trumble

Hey @cl4udio 

Welcome to the community! Thanks for asking for help with your custom font.

Can you share a little more on what you mean it wont work. Are you getting an error? If so, what error are you getting?

Often times we see an error with the CORS settings. Make sure to enable Cross-Origin Resource Sharing (CORS) by setting the Access-Control-Allow-Origin header to *, so the font can be accessed by your recipients’ inboxes. Learn more about CORS. 

I’ll be in the lookout for your response!

6 replies

stephen.trumble
Forum|alt.badge.img+60
  • Klaviyo Alum
  • 1515 replies
  • Answer
  • March 9, 2023

Hey @cl4udio 

Welcome to the community! Thanks for asking for help with your custom font.

Can you share a little more on what you mean it wont work. Are you getting an error? If so, what error are you getting?

Often times we see an error with the CORS settings. Make sure to enable Cross-Origin Resource Sharing (CORS) by setting the Access-Control-Allow-Origin header to *, so the font can be accessed by your recipients’ inboxes. Learn more about CORS. 

I’ll be in the lookout for your response!


cl4udio
Contributor I
Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 2 replies
  • March 9, 2023

Hi @stephen.trumble 

After adding the CORS parameter to the “.htaccess” file, it works like a charm! 😎

 

Thank you very much.


stephen.trumble
Forum|alt.badge.img+60
  • Klaviyo Alum
  • 1515 replies
  • March 9, 2023

Hey @cl4udio 

I’m so glad you were able to get it solved! Thanks again for being part of the community. Looking forward to seeing you here again!


Forum|alt.badge.img+3
  • Contributor IV
  • 9 replies
  • November 27, 2023

Hi @stephen.trumble 

After adding the CORS parameter to the “.htaccess” file, it works like a charm! 😎

 

Thank you very much.

 

Hi @cl4udio, how did you find exactly what to add to the .htaccess file from the provided link?
I’m trying to do the same thing at the moment.

Any help would be greatly appreciated.


cl4udio
Contributor I
Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 2 replies
  • November 27, 2023

Hi @fandf ,

 

Just add the following parameters to the .htaccess file:

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

Here an example if you’re using WordPress:

 

Official APACHE source: https://enable-cors.org/server_apache.html

 

Tell me if this works well for you... 😎


Forum|alt.badge.img+3
  • Contributor IV
  • 9 replies
  • November 27, 2023

@cl4udio all working perfectly. Thanks so much. 

That’s one less stressor for today. Thank you!