linux伪静态程序,Typecho程序伪静态规则大全(包括Linux/Windows)

虽然老左博客是用的wordpress程序,但是我不得不说wp程序即便是一款非常棒的程序之一,但是在资源占用方面的问题还是比较差的。如果你使用过wp程序建立博客应该知道,在网站访问量达到几百的时候一般的主机cpu会超标,甚至会出现被暂停主机使用。因为一般的主机产品cpu限制为5-10%,所以很容易超标。typecho博客程序是国人开发的,虽然目前不在更新但是功能基本完善,结构看类似wordpress,但是在占用资源上比wp好很多。所以typecho用户还是非常多的。

typecho程序的伪静态规则不同于wp直接默认可用,需要我们手工加载到空间中才可以生效。下面老左整理了这款程序在不同的主机环境中的伪静态规则,希望对大家有所帮助。

1、linux apache环境(.htaccess):

rewriteengine on

# 下面是在根目录,文件夹要修改路径,如 /laozuo/

rewritebase /

rewritecond %{request_filename} !-f

rewritecond %{request_filename} !-d

rewriterule ^(.*)$ /index.php/$1 [l]

# 带 www 的跳转到不带的

rewritecond %{http_host} ^www.laozuo.org

rewriterule (.*) http://laozuo.org/$1 [r=301,l]

# 不带 www 的跳转到带的

rewritecond %{http_host} ^laozuo.org

rewriterule (.*) http://www.laozuo.org/$1 [r=301,l]

2、linux apache环境(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伪静态(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]

因为老左只有apache空间,所以测试是没有问题的,其他环境有朋友可以测试,如果遇到问题可以给我留言。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值