A Complete Collection of Pseudo-Static Rules for Typecho on Various Web Servers

7,672 2

Typecho is an excellent blogging system developed by Chinese developers. Its codebase is compact, and it is simple and user-friendly. Recently, I also had a project built with Typecho, so naturally I took some time to explore the program. The biggest issue was still pseudo-static configuration: the official documentation did not provide pseudo-static rules for IIS and Nginx, so I had to spend a long time searching for information and testing compatibility. Fortunately, after all that work, I did achieve some results. Below, I am posting pseudo-static rules for setting up Typecho on various Web servers, so everyone can avoid the trouble of searching for them.

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]

These rules were written based on the official version 1.1. If you encounter any problems, feel free to mention them in the comments below.

Comments

(2)
  1. Chrome 81 Windows 10

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

Leave a comment