Typecho伪静态去除/index/_

@时雨#日记2019/8/44 分钟

先来几张去掉后的效果图

1.文章页面

TIM截图20190804142908.jpg
TIM截图20190804142908.jpg

2.独立页面

TIM截图20190804142916.jpg
TIM截图20190804142916.jpg

3.分类页面

TIM截图20190804142922.jpg
TIM截图20190804142922.jpg

嗯,去掉后是不是感觉link变得简洁了好多。

下面是配置文件

nginx 配置

Text
server {
        listen          80;
        server_name     yourdomain.com;
        root            /home/yourdomain/www/;
        index           index.html index.htm index.php;

        if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php$1 last;
        }

        location ~ .*\.php(\/.*)*$ {
            include fastcgi.conf;
            fastcgi_pass  127.0.0.1:9000;
        }

        access_log logs/yourdomain.log combined;
    }

apache 配置

Text
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]

</IfModule>

后台处理

配置完服务器后还有在后台永久链接那儿将自定义文章路径改成WordPress类型
然后使用地址重写功能保存设置即可啦。

$ls -lt ./articles
├─
[prev]上一篇旧博客数据重见天日啦@2019/8/2
└─
[next]下一篇坦白说 - 举报抓包@2019/8/4
────────────────────────
$cat ./comments

评论 (0)

暂无评论,来抢沙发吧

EOF_