[web] Wordpress国内访问极慢原因的调查及解决 - 将fonts.googleapis.com的参照放在本地

博客首页 » web Wordpress国内访问极慢原因的调查及解决 - 将fonts.googleapis.com的参照放在本地

发布于 02 Jun 2014 10:51
标签 blog
在国内,Wordpress网站访问的速度奇慢无比,通过打开Chrome的network,可以发现是fonts.googleapis.com的css参照非常慢。通过把相应资源放在自己的服务器本地的方法,可以有效解决这个问题。

只需要把其中的fonts.googleapis.com修改成/cache/fonts.googleapis.com/css,然后通过proxy下载fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,900italic,300,400,600,700,900&subset=latin-ext,latin的内容,保存到/cache/fonts.googleapis.com/css中即可。

下载自己的Wordpress的完整网站,全文查找就发现有如下参照fonts.googleapis.com的地方。
public_html\wp-content\plugins\google-publisher\Updater.php(33,49) const SITE_DATA_SERVER_ENDPOINT = 'https://www.googleapis.com'; $font_url = add_query_arg( 'family', urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ), "fonts.googleapis.com/css" );" $fonts_url = add_query_arg( $query_args, "fonts.googleapis.com/css" );" $font_url = add_query_arg( $query_args, "$protocol:fonts.googleapis.com/css" );" $scripts->add( 'prototype', 'ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js', array(), '1.7.1');" $scripts->add( 'scriptaculous-root', 'ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js', array('prototype'), '1.9.0');" $scripts->add( 'scriptaculous-builder', 'ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/builder.js', array('scriptaculous-root'), '1.9.0');" $scripts->add( 'scriptaculous-dragdrop', 'ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.9.0');" $scripts->add( 'scriptaculous-effects', 'ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/effects.js', array('scriptaculous-root'), '1.9.0');" $scripts->add( 'scriptaculous-slider', 'ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/slider.js', array('scriptaculous-effects'), '1.9.0');" $scripts->add( 'scriptaculous-sound', 'ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/sound.js', array( 'scriptaculous-root' ), '1.9.0' );" $scripts->add( 'scriptaculous-controls', 'ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/controls.js', array('scriptaculous-root'), '1.9.0');" $open_sans_font_url = "fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets";" @import url(fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=latin-ext,latin); " "
public_html\wp-content\themes\twentyfourteen\functions.php(214,115) $font_url = add_query_arg( 'family', urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ), ""fonts.googleapis.com/css"" );"
public_html\wp-content\themes\twentythirteen\functions.php(149,52) $fonts_url = add_query_arg( $query_args, ""fonts.googleapis.com/css"" );"
public_html\wp-content\themes\twentytwelve\functions.php(121,61) $font_url = add_query_arg( $query_args, ""$protocol:fonts.googleapis.com/css"" );"
public_html\wp-includes\script-loader.php(148,37) $scripts->add( 'prototype', 'ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js', array(), '1.7.1');"
public_html\wp-includes\script-loader.php(149,46) $scripts->add( 'scriptaculous-root', 'ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js', array('prototype'), '1.9.0');"
public_html\wp-includes\script-loader.php(150,49) $scripts->add( 'scriptaculous-builder', 'ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/builder.js', array('scriptaculous-root'), '1.9.0');"
public_html\wp-includes\script-loader.php(151,50) $scripts->add( 'scriptaculous-dragdrop', 'ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.9.0');"
public_html\wp-includes\script-loader.php(152,49) $scripts->add( 'scriptaculous-effects', 'ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/effects.js', array('scriptaculous-root'), '1.9.0');"
public_html\wp-includes\script-loader.php(153,48) $scripts->add( 'scriptaculous-slider', 'ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/slider.js', array('scriptaculous-effects'), '1.9.0');"
public_html\wp-includes\script-loader.php(154,47) $scripts->add( 'scriptaculous-sound', 'ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/sound.js', array( 'scriptaculous-root' ), '1.9.0' );"
public_html\wp-includes\script-loader.php(155,50) $scripts->add( 'scriptaculous-controls', 'ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/controls.js', array('scriptaculous-root'), '1.9.0');"
public_html\wp-includes\script-loader.php(602,33) $open_sans_font_url = ""fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets"";"
public_html\wp-includes\js\tinymce\plugins\compat3x\css\dialog.css(1,20) @import url(fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=latin-ext,latin);
public_html\_file-manager\elfinder.php(7,74) <link rel=""stylesheet"" type=""text/css"" media=""screen"" href=""http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css"">"
public_html\_file-manager\elfinder.php(8,50) <script type=""text/javascript"" src=""http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js""></script>"
public_html\_file-manager\elfinder.php(9,50) <script type=""text/javascript"" src=""http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js""></script>"

Reference:
http://myoa.info/articles/20/web-wordpress%E4%B8%AD%E5%B0%86fonts-googleapis-com%E7%9A%84%E5%8F%82%E7%85%A7%E6%94%BE%E5%9C%A8%E6%9C%AC%E5%9C%B0/


本页面的文字允许在知识共享 署名-相同方式共享 3.0协议和GNU自由文档许可证下修改和再使用,仅有一个特殊要求,请用链接方式注明文章引用出处及作者。请协助维护作者合法权益。


系列文章

文章列表

  • web Wordpress国内访问极慢原因的调查及解决 - 将fonts.googleapis.com的参照放在本地

这篇文章对你有帮助吗,投个票吧?

rating: 0+x

留下你的评论

Add a New Comment