AI摘要

本文介绍了如何在Typecho博客系统中开启伪静态并隐藏index.php。首先,在后台开启伪静态并选择URL形式。如果无法自动配置,需要手动设置服务器的rewrite规则。文章提供了nginx和apache的配置示例,并指出配置可以放在服务器配置文件或.htaccess中。如果遇到问题,可以参考Typecho官方文档。
本文介绍了如何在T

1.后台配置typecho伪静态

如图,在typecho后台,开启伪静态,并选择你喜好的url形式:
Typecho开启伪静态并隐藏index.php

2.配置服务器的rewrite规则

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

nginx配置

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;
    }

如果还有问题,请参考: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中。

※相关文章推荐※



最后修改:2019 年 05 月 20 日
点赞的人是最酷的