Icon font not working on subdomains of multisite
-
20-04-2021 - |
Вопрос
I have a multi site installation consisting of the main domain and various subdomans.
The domain and subdomain all use the one theme however the icon font of the theme doesn't display/load an any of the subdomains.
Why are subdomains of my multi-site network failing?
Решение
The problem:
Console log:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at xxx. (Reason: CORS header 'Access-Control-Allow-Origin' missing).
The solution:
Add the following header to your .htaccess file:
# https://wordpress.org/support/topic/font-awesome-not-working?replies=8#post-4921179
# Allow icon font to load on subdomains of WordPress multisite install.
<FilesMatch ".(ttf|otf|woff)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
...before:
# END WordPress
Не связан с wordpress.stackexchange