华域联盟 Linux Typecho程序伪静态规则大全(包括Linux/Windows)

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

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

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

1、Linux Apache环境(.htaccess):

复制代码 代码如下:

<IfModule mod_rewrite.c>

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]
</IfModule>

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空间,所以测试是没有问题的,其他环境有朋友可以测试,如果遇到问题可以给我留言。
您可能感兴趣的文章:

本文由 华域联盟 原创撰写:华域联盟 » Typecho程序伪静态规则大全(包括Linux/Windows)

转载请保留出处和原文链接:https://www.cnhackhy.com/45027.htm

本文来自网络,不代表华域联盟立场,转载请注明出处。

作者: sterben

发表回复

联系我们

联系我们

2551209778

在线咨询: QQ交谈

邮箱: [email protected]

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部