2017-12-28 12 views
0

私のCSSで作業した後、Apache Webサーバでホストされている私のウェブサイトを最適化する。私はいつもYSlow Scoreを58%、PageSpeedを80%にしています。助けが必要です。Gtmetrix:Add私の.htaccess、Apache Serverにヘッダを追加する。ここに問題と私の.htaccessファイルの設定を示す結果がある。

the image is showing the components that said that they don't have a "far-future expiration date" (click here)

これは私は私はあなたがGtmetrixからもらったスクリーンショットを見たGtmetrix.com

<IfModule mod_rewrite.c> 
############################################ 
## enable rewrites 

    Options +FollowSymLinks 
    RewriteEngine on 
# RewriteCond %{HTTP_HOST}!^www\.exemple\.com 

    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-l 
# RewriteRule .* - [S=1] 
    RewriteRule .* index.php [L] 
# RewriteRule (.*)http://www.exemple.com/$1 [R=301,L] 

</IfModule> 


#******************Non www redirect – Canonical Issue****************** 





#************"Compressing files/caching" 
# compress text, HTML, JavaScript, CSS, and XML 
AddOutputFilterByType DEFLATE text/plain 
AddOutputFilterByType DEFLATE text/html 
AddOutputFilterByType DEFLATE text/xml 
AddOutputFilterByType DEFLATE text/css 
AddOutputFilterByType DEFLATE application/xml 
AddOutputFilterByType DEFLATE application/xhtml+xml 
AddOutputFilterByType DEFLATE application/rss+xml 
AddOutputFilterByType DEFLATE application/javascript 
AddOutputFilterByType DEFLATE application/x-javascript 

# remove browser bugs 
BrowserMatch ^Mozilla/4 gzip-only-text/html 
BrowserMatch ^Mozilla/4\.0[678] no-gzip 
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html 
Header append Vary User-Agent 



<IfModule mod_expires.c> 
# Enable expirations 
ExpiresActive On 
# Default directive 
ExpiresDefault "access plus 1 month" 
# My favicon 
ExpiresByType image/x-icon "access plus 1 year" 
# Images 
ExpiresByType image/gif "access plus 1 month" 
ExpiresByType image/png "access plus 1 month" 
ExpiresByType image/jpg "access plus 1 month" 
ExpiresByType image/jpeg "access plus 1 month" 
# CSS 
ExpiresByType text/css "access plus 1 month" 
# Javascript 
ExpiresByType application/javascript "access plus 1 year" 
</IfModule> 



<IfModule mod_headers.c> 
    <FilesMatch "\.(bmp|css|flv|gif|ico|jpg|jpeg|js|pdf|png|svg|swf|tif|tiff|woff|eot|ttif)(\.gz)?$"> 

     Header set Expires "Thu, 22 Mar 2018 20:00:00 GMT" 
     Header unset Etag 
     FileETag None 

     Header set cache-control "max-age=2592000, public" 
    </FilesMatch> 
</IfModule> 

答えて

0

上の解決策として発見され、いくつかの設定を入れて、私の.htaccessファイルで、私はと思いますすべてはあなたと大丈夫ですが、それらのファイルは外部的なものなので、最適化することはできません:)!他の推奨事項をチェックし、良いYSlowのスコアを得るためにそれらを修正しようとすると、最高のお兄さんの仲間:)

+0

あなたの答えのための@midodesign、私の.htaccess設定を変更する必要がありました。今私のための完全に働いています:)再びありがとう –

関連する問題