这篇文章上次修改于 286 天前,可能其部分内容已经发生变化,如有疑问可询问作者。
网站安全
修改后台路径
1、改掉admin这个文件夹的名字
2、打开根目录下的config.inc.php文件,admin修改成新名字。
define('__TYPECHO_ADMIN_DIR__', '/admin/');
加入奇安信Webscanx
<a href="https://webscan.qianxin.com/safe/detail/?query=www.ewwe.net"><img border="0" src="https://webscan.qianxin.com/api/authcode?code=0167e4caec1f02c46dde49c3b8ccafb4" style="display: none;"/></a>
后台速度优化
去除官方日志
打开 admin/index.php,找到下面的代码并删除,在 96-105 行。
<div class="col-mb-12 col-tb-4" role="complementary">
<section class="latest-link">
<h3><?php _e('官方最新日志'); ?></h3>
<div id="typecho-message">
<ul>
<li><?php _e('读取中...'); ?></li>
</ul>
</div>
</section>
</div>
去除官方更新检测
接着找到下面的代码并删除,在 105-147 行。
<script>
$(document).ready(function () {
var ul = $('#typecho-message ul'), cache = window.sessionStorage,
html = cache ? cache.getItem('feed') : '',
update = cache ? cache.getItem('update') : '';
if (!!html) {
ul.html(html);
} else {
html = '';
$.get('<?php $options->index('/action/ajax?do=feed'); ?>', function (o) {
for (var i = 0; i < o.length; i ++) {
var item = o[i];
html += '<li><span>' + item.date + '</span> <a href="' + item.link + '" target="_blank">' + item.title
+ '</a></li>';
}
ul.html(html);
cache.setItem('feed', html);
}, 'json');
}
function applyUpdate(update) {
if (update.available) {
$('<div class="update-check"><p>'
+ '<?php _e('您当前使用的版本是 %s'); ?>'.replace('%s', update.current) + '<br />'
+ '<strong><a href="' + update.link + '" target="_blank">'
+ '<?php _e('官方最新版本是 %s'); ?>'.replace('%s', update.latest) + '</a></strong></p></div>')
.appendTo('.welcome-board').effect('highlight');
}
}
if (!!update) {
applyUpdate($.parseJSON(update));
} else {
update = '';
$.get('<?php $options->index('/action/ajax?do=checkVersion'); ?>', function (o, status, resp) {
applyUpdate(o);
cache.setItem('update', resp.responseText);
}, 'json');
}
});
</script>
去除主题更新检测
编辑文件 functions.php,删除以下部分
Single::update();
修改gravatar头像源
打开var/Typecho/Common.php,找到下面的代码,大概在937行。
$url = $isSecure ? 'https://secure.gravatar.com' : 'http://www.gravatar.com';
替换为:
$url = $isSecure ? 'https://gravatar.loli.net' : 'https://sdn.geekzu.org';
附其他Gravatar头像源:
V2EX源 https://cdn.v2ex.com/gravatar/
Loli源 https://gravatar.loli.net/avatar/
极客族 https://sdn.geekzu.org/avatar/
压缩背景图片
使用https://tinypng.com/进行压缩。
压缩icon.png background.jpg 上传到网站themes/Single/img 目录。
开启 gzip 压缩功能
在网站根目录的 index.php 头部添加一段代码如下:
/** 开启gzip压缩 */
ob_start('ob_gzhandler');
完成后,使用 网页GZIP压缩检测 检查结果
网站伪静态
宝塔网站后台伪静态设置,选择Typecho即可。
没有评论