0 レビュー
1 回答
php-font-faceが.htaccessファイルで機能しない
Webサイトに使用しているカスタムフォントがあり、CSSは次のようになります:
@font-face {
font-family: 'roboto_condensed';
src: url('RobotoCondensed-Regular-webfont.eot');
src: url('RobotoCondensed-Regular-webfont.eot?#iefix') format('embedded-opentype'),
url('RobotoCondensed-Regular-webfont.woff') format('woff'),
url('RobotoCondensed-Regular-webfont.ttf') format('truetype'),
url('RobotoCondensed-Regular-webfont.svg#roboto_condensedregular') format('svg');
font-weight: normal;
font-style: normal;
}
それは完全にうまく機能します。robotoを表示したいすべての場所で機能します。ただし、次のような.htaccessファイルを導入すると正しく機能しなくなります。
ErrorDocument 404 /error.php
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteRule ^(\w+)$ ./index.php?role=$1
RewriteRule ^(\w+)/$ ./index.php?role=$1
RewriteRule ^([\w]+)/([\w\s\.\']+)&([\s\w\'\.]+)$ ./result.php?role=$1&champ1=$2&champ2=$3
現在、私はhtaccessファイルが得意ではありませんが、元のサーバーでは上記のコードが正常に機能していたことはわかっていますが、新しいサーバーに移動すると、次のコードが表示されます。フォントは一列に並んでいて、robotoではありません。これは私のapache設定の問題でしょうか、それとも私が持っているCSSまたは私の.htaccessファイルのいずれかに明らかな危険信号がありますか?
わからない
0
レビュー
答え :
解決策:
<IfModule mod_expires.c>
ExpiresByType application/font-woff "access 1 month"
ExpiresByType application/font-woff2 "access 1 month"
ExpiresByType application/vnd.ms-fontobject "access 1 month"
ExpiresByType application/x-font-ttf "access 1 month"
ExpiresByType font/opentype "access 1 month"
わからない
同様の質問
私たちのウェブサイトで同様の質問で答えを見つけてください。