K
K
kotey2017-01-06 14:00:19
HTML
kotey, 2017-01-06 14:00:19

How to solve the problem with loading fonts?

Good day, dear ones!
There was such a problem - the fonts on the site are not loaded. At the same time, everything works fine on the local host.
I checked it once - all the paths are spelled out correctly, the Firefox console shows 200 OK, but the fonts do not work, even cry!
For testing, I connected the font with Googlefont - it works.
In the end, I think I found the problem! In the .htaccess file, requests are sent to index.php (for CNC)

DirectoryIndex index.php
AddDefaultCharset windows-1251
AddCharset windows-1251 .php
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^www].*)$
RewriteRule ^(.*)$ http://www.%1/$1 [L,R=301]
RewriteRule .* index.php [L]

and because of this, the download is blocked on the server itself.
But how to get around this? =( Write to the hoster's support service... So it is there a) brake, b) designed for graduates of the Higher School of Programming (all words with a capital). That is, they seem to answer, but this answer should be posted right here, on the Toaster, with a cry: "People, explain, for the love of all that is holy, what they want!"
In general, so far the only thing I have thought of is to upload the fonts to another host and connect via link. But this is such a perversion.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
krumza, 2017-01-06
@krumza

not at all because of this, you
show how to connect the font in css or by some other method what kind
of font

K
kotey, 2017-01-06
@kotey

krumza , strange. It's just that when you remove this line RewriteRule .* index.php [L] in .htaccess, the fonts work (but the CNC collapses and the site itself does not plow, of course).
Connection is standard:

@font-face {
  font-family: "RobotoRegular";
  src: url("../fonts/RobotoRegular/RobotoRegular.eot");
  src: url("../fonts/RobotoRegular/RobotoRegular.eot?#iefix") format("embedded-opentype"),
  url("../fonts/RobotoRegular/RobotoRegular.woff") format("woff"),
  url("../fonts/RobotoRegular/RobotoRegular.ttf") format("truetype");
  font-style: normal;
  font-weight: normal;
}
@font-face {
  font-family: 'Decor6Di';
  src: url('../fonts/Decor6Di/Decor6Di.eot');
  src: url('../fonts/Decor6Di/Decor6Di.eot') format('embedded-opentype'),
  url('../fonts/Decor6Di/Decor6Di.woff2') format('woff2'),
  url('../fonts/Decor6Di/Decor6Di.woff') format('woff'),
  url('../fonts/Decor6Di/Decor6Di.ttf') format('truetype');
}

сами файлы в папке fonts в подпапках Decor6Di и RobotoRegular
Причем, консоль показывает, что шрифты 200 ОК, но вот не отображаются и всё =(

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question