修改了固定链接,缩小首页大小,优化js

提醒:本文最后更新于 2652 天前,文中所描述的信息可能已发生改变,请仔细核实。

首先要说的是。。。我的文章链接地址确实是比较长。

一般是https://kn007.net/topics/2012/07/02/about-me/

现在改成https://kn007.net/topics/about-me/

因为在链接显示日期实无必要。。。也不知当初怎么想的。。。

想来这已经是第2次改链接了,为了保证原始链接仍然有效,使用了转发规则

rewrite ^/topics/([0-9]+)/([0-9]+)/([0-9]+)/(.*)/$ /topics/$4/ permanent;
rewrite ^/topics/([0-9]+)/([0-9]+)/([0-9]+)/(.*)/(.*)$ /topics/$4/$5 permanent;//这句可不要,一般浏览器都会跳转

这样的话,旧链接仍然生效,会被301到新地址。

固定链接历史:

/topics/%year%/%monthnum%/%day%/%postname%.html
/topics/%year%/%monthnum%/%day%/%postname%/
/topics/%postname%/

已用转发规则:

rewrite ^/topics/(.*).html$ /topics/$1/ permanent;
rewrite ^/topics/(.*).html/(.*)$ /topics/$1/$2 permanent;
rewrite ^/topics/([0-9]+)/([0-9]+)/([0-9]+)/(.*)/(.*)$ /topics/$4/$5 permanent;
rewrite ^/topics/([0-9]+)/([0-9]+)/([0-9]+)/(.*)/$ /topics/$4/ permanent;

另外就是,优化了首页js,去除一些不必要的js,另外重新整合首页连接。减小首页体积

转载请注明转自:kn007的个人博客的《修改了固定链接,缩小首页大小,优化js