Typecho伪静态设置


Typecho伪静态设置


1) “设置”,点击永久链接

2) 开启伪静态,并设置伪静态路径规则

文章路径个性化定义:
/archives/{cid}.html

独立页面路径:
/{slug}.html

分类路径:
/category/{slug}.html

3-1) Linux下Apache 环境(.htaccess)

RewriteEngine On

下面是在根目录,文件夹要修改路径
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

3-2) 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;
}

3-3) 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]

Leave a Comment