Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 网页速度没有增加_Javascript_Html_.htaccess_Cdn_Keep Alive - Fatal编程技术网

Javascript 网页速度没有增加

Javascript 网页速度没有增加,javascript,html,.htaccess,cdn,keep-alive,Javascript,Html,.htaccess,Cdn,Keep Alive,我优化我的网站,并测试我的网站与伟大的在线工具 但在这里我看到我的设置不起作用,但一些在线工具接受我的设置 50%的在线速度检查工具显示我的网站“保持活力”处于启用状态, 但50%的在线速度工具显示“保持活力”未设置 如图片第二栏所示,在所有css和js上,keep alive处于启用状态,但在某些图片上keep alive处于启用状态,而在某些图片上keep alive处于禁用状态,请告诉我为什么在某些图片上未设置keep alive 这是我的.htaccess文件代码 RewriteEng

我优化我的网站,并测试我的网站与伟大的在线工具

但在这里我看到我的设置不起作用,但一些在线工具接受我的设置

50%的在线速度检查工具显示我的网站“保持活力”处于启用状态, 但50%的在线速度工具显示“保持活力”未设置

如图片第二栏所示,在所有css和js上,keep alive处于启用状态,但在某些图片上keep alive处于启用状态,而在某些图片上keep alive处于禁用状态,请告诉我为什么在某些图片上未设置keep alive

这是我的.htaccess文件代码

RewriteEngine on
RewriteBase / 

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php/$1 

    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access 1 month"
    ExpiresByType text/css "access 1 month"
    ExpiresByType text/javascript "access 1 month"
    ExpiresByType text/plain "access 1 month"

    ExpiresByType image/gif "access 1 month"
    ExpiresByType image/png "access 1 month"
    ExpiresByType image/jpeg "access 1 month"
    ExpiresByType image/jpg "access 1 month"
    ExpiresByType application/x-javascript "access 1 month"
    ExpiresByType application/javascript "access 1 month"
    ExpiresByType application/x-shockwave-flash "access 1 month"
    ExpiresByType application/x-icon "access 1 year"
</IfModule> 
我做什么?在第1列中,您可以看到css/js是用子域名加载的,但CDN列中说CDN未设置

  • 在HTTP/1.1中,“保持活动”默认为打开,测试结果中的错误可能是由于图像太大而导致活动连接超时
  • 2.CDN不是包含“CDN”的域中的文件,它是一种网络服务器技术,请看

    <ifModule mod_headers.c>
        Header set Connection keep-alive
    </ifModule>
    
    <FilesMatch ".(ttf|otf|eot|woff)$">
    <IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
    </IfModule>
    </FilesMatch>
    
    eg.1 cdn.domin.com/css/style.css
    eg.2 cdn.domin.com/js/script.js