0

I'm trying preload a file pushing it by an HTML header based on HTTP/2 directive. But I receive an error 500 after make any modification in htaccess file.

Here is the piece of code that i'm using in htaccess:

# add custom header to single file
<Files index.html>
    Link: </themes/PRS060142/assets/css/570eb83859dc23dd0eec423a49e147fe.woff2>; rel=preload; as=font
</Files>

Somebody knows what is the correct way to send HTML heads by htaccess?

1 Answers1

2

This is the syntax for Apache (I've shorted the full path for readability):

<Files index.html>
    Header add Link "</theme...fe.woff2>; rel=preload; as=font; crossorigin"
</Files>

Note you also need to add the crossorigin attribute for fonts - because of various reasons :-)

Barry Pollard
  • 40,655
  • 7
  • 76
  • 92