Typecho 程式伺服器偽靜態規則大全
7,651 2
Typecho 是由國人開發的一套非常優秀的部落格系統,程式碼短小,簡單友善,最近也有個專案是用 Typecho 搭建的,理所當然地對該程式有了一點探討,最大的問題還是偽靜態方面,官方沒有給出 IIS 和 Nginx 的偽靜態規則,還得我折騰老半天去搜尋資料,還要測試相容性,所幸忙了許久還是有收穫的,下面我就發上各種 Web 伺服器搭建 Typecho 的偽靜態規則,省得大家麻煩去找。

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]
規則是根據正式版 1.1 撰寫的,如果有什麼問題可以在下方評論提出。
評論
(2)谢谢你的帮助,现在我也设置好了伪静态,可以改网址了
不客气呢 ::aru:confuse::