WordPress七牛镜存储插件,WP SUPER CACHE的CDN功能,都是可以通过代码实现的。The Qiniu mirror storage plug-in and the CDN function of WP SUPER CACHE can all be implemented by code.
The first step is to upload the wp-content and wp-includes directories in your blog to the object storage of Qiniu or YouPaiyun, Tencent Cloud, and Alibaba Cloud. The second step is to upload the files, and modify the website address in the following code Become your blog domain name (note: do not add / at the end) cdn domain name is changed to the domain name bound to the object storage, fill in the default domain name (note: do not add / at the end), and then put the following code into the theme's functions.php file At the bottom of the web site URL domain name setting acceleration directory setting file whitelist}{);}}}}}}}}}}}}}}}}}}
第一步
把你博客里的wp-content
和wp-includes
目录上传到七牛或又拍云、腾讯云、阿里云的对象存储中
第二步
上传文件完之后,将以下代码中的网站地址修改成你的博客域名
(注:结尾不要加 / )cdn域名
修改成对象存储绑定的域名没有就填默认的域名(注:结尾不要加 / ),然后将以下代码放入主题的functions.php文件中最底部即可
define('FocusCDNHost','http://www.31du.cn');//wordpress网站网址
define('FocusCDNRemote','http://old.31du.cn');//cdn域名
define('FocusCDNIncludes','wp-content,wp-includes');//设置加速目录
define('FocusCDNExcludes','.php|.xml|.html|.po|.mo');//设置文件白名单
define('FocusCDNRelative','');//Check this if you want to have links like <wp-content/abc.png> rewritten - i.e. without your blog's domain as prefix.