前言 Typecho是由国人开发的一套非常优秀的博客系统,代码短小,简单友好,如果我们仅仅是用于文档要求写作的话,那Typecho绝对是互联网写博客的首选程序。 就按我个人来说,我是用宝塔进行管理的,因为对小白友好的一批,安装好Typecho程序后第一步就是去设置伪静态了,不然...你就会翻车 以下会全方面针对不同服务器例如Linux、WEB、二级目录伪静态规则等,资料均来自互联网,有任何问题或者建议或者都欢迎留言,废话不多说直接开始操作。 Linux宝塔设置 以宝塔面板为例子,我们找到 网站-站点设置-伪静态 (如上图)
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php$1 last;
}
将上方代码复制粘贴到指定位置就可以了
WEB伪静态规则 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>
Nginx设置
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php$1 last;
}
IIS设置
[ISAPI_Rewrite]
CacheClockRate 3600
RepeatLimit 32
RewriteRule /tag/(.*) /index.php?tag=$1
RewriteRule /sitemap.xml /sitemap.xml [L]
RewriteRule /favicon.ico /favicon.ico [L]
RewriteRule /(.*).html /index.php/$1.html [L]
RewriteRule /(.*)/comment /index.php/$1/comment [L]
RewriteRule /category/(.*) /index.php/category/$1 [L]
RewriteRule /page/(.*) /index.php/page/$1 [L]
RewriteRule /search/(.*) /index.php/search/$1 [L]
RewriteRule /feed/(.*) /index.php/feed/$1 [L]
RewriteRule /2(.*) /index.php/2$1 [L]
RewriteRule /action(.*) /index.php/action$1 [L]
二级扩展伪静态 在使用Typecho程序的时候安装在二级目录中,如果正常设置伪静态的时候是在 CONF文件设置即可,但是如果是二级目录的话,那我们就这样设置如下操作
location /foldername/ {
if (!-e $request_filename) {
rewrite ^(.*)$ /foldername/index.php$1 last;
}
}
这里我们看到foldername没有,我们可以在根目录原来Typecho Nginx伪静态规则.conf文件中加上上面的伪静态,然后将foldername换成我们子目录的文件夹即可。