关注迷你日志公众号

Typecho后台设置永久链接后,会在域名后加上index.php,很多人都接受不了。那么怎么开启typecho的伪静态,并隐藏index.php呢?

1.后台配置typecho伪静态

在typecho后台,开启伪静态,并选择你喜好的url形式:

2.配置服务器的rewrite规则

如果在保存上述配置的时候,typecho无法自动配置,那么你可能需要手动配置服务器的rewrite规则。

nginx配置

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

如果还有问题,请参考:http://docs.typecho.org/servers?s%5B%5D=nginx

apache配置

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

此配置可以放在apache的conf文件中,或者放在.htaccess中。

文章目录
扫码了解详情