Typecho 程序服务器伪静态规则大全

7,652 2

Typecho 是由国人开发的一套非常优秀的博客系统,代码短小,简单友好,最近也有个项目是用 Typecho 搭建的,理所当然的对该程序有了一点探讨,最大的问题还是伪静态方面,官方没有给出 IIS 和 Nginx 的伪静态规则,还得我折腾老半天去搜索资料,还要测试兼容性,所幸忙了许久还是有收获的,下面我就发上各种 Web 服务器搭建 Typecho 的伪静态规则,省的大家麻烦去找。

Apache

Plain Text
<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]</IfModule>

Nginx

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

IIS

Plain Text
[ISAPI_Rewrite]CacheClockRate 3600RepeatLimit 32RewriteRule /tag/(.*) /index\.php\?tag=$1RewriteRule /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]

规则是根据正式版 1.1 写的,如果有什么问题可以在下方评论提出。

评论

(2)
  1. Chrome 81 Windows 10

    谢谢你的帮助,现在我也设置好了伪静态,可以改网址了

发布评论