Typecho偽靜態設置


鼠標移到頂部菜單的“設置”,點擊永久鏈接
jc01

開啟偽靜態,並設置偽靜態路徑規則
jc02

文章路徑個性化定義
/archives/{cid}.html

獨立頁面路徑
/{slug}.html

分類路徑:
/category/{slug}.html

Linux下Apache 環境(.htaccess)

<IfModule mod_rewrite.c>
RewriteEngine On
# 下面是在根目錄,文件夾要修改路徑
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

Linux下Nginx 環境(nginx.conf)

if (-f $request_filename/index.html){
    rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
    rewrite (.*) $1/index.php;
}
if (!-e $request_filename){
    rewrite (.*) /index.php;
}

Windows下IIS 環境(httpd.ini)

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# 中文tag解決
RewriteRule /tag/(.*) /index\.php\?tag=$1
# sitemapxml
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]
# feed
RewriteRule /feed/(.*) /index.php/feed/$1 [L]
# 日期歸檔
RewriteRule /2(.*) /index.php/2$1 [L]
# 上傳圖片等
RewriteRule /action(.*) /index.php/action$1 [L]
 
0


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM