Typecho程序偽靜態(tài)規(guī)則大全(包括Linux/Windows)
更新時間:2012年09月17日 22:55:12 作者:
Typecho程序的偽靜態(tài)規(guī)則不同于wp直接默認可用,需要我們手工加載到空間中才可以生效。下面老左整理了這款程序在不同的主機環(huán)境中的偽靜態(tài)規(guī)則,希望對大家有所幫助
雖然老左博客是用的Wordpress程序,但是我不得不說wp程序即便是一款非常棒的程序之一,但是在資源占用方面的問題還是比較差的。如果你使用過WP程序建立博客應該知道,在網(wǎng)站訪問量達到幾百的時候一般的主機CPU會超標,甚至會出現(xiàn)被暫停主機使用。因為一般的主機產(chǎn)品CPU限制為5-10%,所以很容易超標。Typecho博客程序是國人開發(fā)的,雖然目前不在更新但是功能基本完善,結(jié)構(gòu)看類似WORDPRESS,但是在占用資源上比WP好很多。所以Typecho用戶還是非常多的。
Typecho程序的偽靜態(tài)規(guī)則不同于wp直接默認可用,需要我們手工加載到空間中才可以生效。下面老左整理了這款程序在不同的主機環(huán)境中的偽靜態(tài)規(guī)則,希望對大家有所幫助。
1、Linux Apache環(huán)境(.htaccess):
<IfModule mod_rewrite.c>
RewriteEngine On
# 下面是在根目錄,文件夾要修改路徑,如 /laozuo/
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
# 帶 www 的跳轉(zhuǎn)到不帶的
RewriteCond %{HTTP_HOST} ^www.laozuo.org
RewriteRule (.*) http://laozuo.org/$1 [R=301,L]
# 不帶 www 的跳轉(zhuǎn)到帶的
RewriteCond %{HTTP_HOST} ^laozuo.org
RewriteRule (.*) http://www.laozuo.org/$1 [R=301,L]
</IfModule>
2、Linux Apache環(huán)境(Nginx):
location / {
index index.html index.php;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php) {
rewrite (.*) $1/index.php;
}
if (!-f $request_filename) {
rewrite (.*) /index.php;
}
}
3、Windows IIS偽靜態(tài)(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]
# 內(nèi)容頁
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]
因為老左只有apache空間,所以測試是沒有問題的,其他環(huán)境有朋友可以測試,如果遇到問題可以給我留言。
Typecho程序的偽靜態(tài)規(guī)則不同于wp直接默認可用,需要我們手工加載到空間中才可以生效。下面老左整理了這款程序在不同的主機環(huán)境中的偽靜態(tài)規(guī)則,希望對大家有所幫助。
1、Linux Apache環(huán)境(.htaccess):
復制代碼 代碼如下:
<IfModule mod_rewrite.c>
RewriteEngine On
# 下面是在根目錄,文件夾要修改路徑,如 /laozuo/
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
# 帶 www 的跳轉(zhuǎn)到不帶的
RewriteCond %{HTTP_HOST} ^www.laozuo.org
RewriteRule (.*) http://laozuo.org/$1 [R=301,L]
# 不帶 www 的跳轉(zhuǎn)到帶的
RewriteCond %{HTTP_HOST} ^laozuo.org
RewriteRule (.*) http://www.laozuo.org/$1 [R=301,L]
</IfModule>
2、Linux Apache環(huán)境(Nginx):
復制代碼 代碼如下:
location / {
index index.html index.php;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php) {
rewrite (.*) $1/index.php;
}
if (!-f $request_filename) {
rewrite (.*) /index.php;
}
}
3、Windows IIS偽靜態(tài)(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]
# 內(nèi)容頁
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]
因為老左只有apache空間,所以測試是沒有問題的,其他環(huán)境有朋友可以測試,如果遇到問題可以給我留言。
相關(guān)文章
關(guān)于Linux下conda安裝caffe與pb轉(zhuǎn)caffe問題
這篇文章主要介紹了關(guān)于Linux下conda安裝caffe與pb轉(zhuǎn)caffe問題,文中以圖文說明了conda安裝caffe的方法,需要的朋友可以參考下2023-03-03linux: centos設(shè)置ip以及連接外網(wǎng)的方法
本篇文章主要介紹了linux: centos設(shè)置ip以及連接外網(wǎng)的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-02-02Linux中設(shè)置路由以及虛擬機聯(lián)網(wǎng)圖文詳解
這篇文章主要介紹了Linux中設(shè)置路由以及虛擬機聯(lián)網(wǎng),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2019-04-04CentOS 7.x NAT模式上網(wǎng)配置步驟詳解
本篇文章主要介紹了CentOS 7.x NAT模式上網(wǎng)配置步驟詳解,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-02-02Linux中對lvm邏輯卷分區(qū)大小的調(diào)整教程(針對xfs與ext4不同文件系統(tǒng))
這篇文章主要給大家介紹了關(guān)于Linux中對lvm邏輯卷分區(qū)大小的調(diào)整教程(針對xfs與ext4不同文件系統(tǒng))的相關(guān)資料,文中通過示例代碼介紹的非常詳細,需要的朋友可以參考借鑒,下面隨著小編來一起學習學習吧2018-10-10