Typecho 在小皮面板中添加伪静态规则

WordPress 程序资源占用率较高,而 Typecho 却只占用非常少的资源,所以使用 Typecho 建站是不错的选择。不过 Typecho 也不是完美的,数据一旦超过10万,运行比较卡,所以 Typecho 适合轻量化的网站。

我惯常使用宝塔面板,在宝塔中,Typecho 伪静态规则在伪静态设置直接添加。不过,我的一个英文站使用了小皮面板,需要手动在后台添加完伪静态规则,才能生效。

以下伪静态规则只能在 Linux 系统中使用。

Apache 环境(.htaccess)

该伪静态规则放到网站根目录 .htaccess 文件中生效。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

Nginx 环境

location / {
index index.html index.php;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php) {
rewrite (.*) $1/index.php;
}
if (!-f $request_filename) {
rewrite (.*) /index.php;
}
}

未经允许不得转载:主机格调 » Typecho 在小皮面板中添加伪静态规则

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏