WordPress伪静态

2013-05-10   来源:站长日记       编辑:沧海桑田   类别:开源博客系统    转载到:    发表评论

伪静态比真正的静态页面空间储存量小,伪静态对服务器的压力相对小,而纯静态对搜索引擎友好,但可能会造成大量磁盘碎片,动态页面对搜索引擎不友好,伪静态好些,纯静态对搜索引擎最好

linux / uninx 主机下WordPress伪静态方法
把文件 .htaccess 放到网站根目录下就可 .htaccess 文件内容如下
# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress


Windows主机WordPress伪静态方法
Windows主机默认实现不了像Linux下的完美伪静态,这是Windows主机下WordPress用户最为头疼的事里, 不过也有解决方法

方法1
1.主机装Rewrite 组件,很多Windows主机默认有这个组件,做伪静态时问下空间商。
2.主机启用了Rewrite模块后,需要httpd.ini文件
httpd.ini
wordpress程序在windows虚拟主机上的伪静态设置

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# Rules to ensure that normal content gets through
RewriteRule /sitemap.xml /sitemap.xml [L]
RewriteRule /favicon.ico /favicon.ico [L]
# For file-based wordpress content (i.e. theme), admin, etc.
RewriteRule /wp-(.*) /wp-$1 [L]
# For normal wordpress content, via index.php
RewriteRule ^/$ /index.php [L]
RewriteRule /(.*) /index.php/$1 [L]

3.把httpd.ini 上传到网站根目录即可


方法2
如果方法1不能实现,可以试下下面这段代码(同样是放到httpd.ini中,然后上传到网站根目录)
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# wordpress 伪静态规则
# For tag(中文标签以及标签翻页的规则)
RewriteRule /tag/(.*)/page/(d+)$ /index.php?tag=$1&paged=$2
RewriteRule /tag/(.+)$ /index.php?tag=$1
# For category(中文分类以及分类翻页的规则)
RewriteRule /category/(.*)/page/(d+)$ /index.php?category_name=$1&paged=$2
RewriteRule /category/(.*) /index.php?category_name=$1
# For sitemapxml
RewriteRule /sitemap.xml /sitemap.xml [L]
RewriteRule /sitemap.html /sitemap.html [L]
RewriteRule /sitemap_baidu.xml /sitemap_baidu.xml [L]
RewriteRule /favicon.ico /favicon.ico [L]
# For file-based wordpress content (i.e. theme), admin, etc.
RewriteRule /wp-(.*) /wp-$1 [L]
# For normal wordpress content, via index.php
RewriteRule ^/$ /index.php [L]
RewriteRule /(.*) /index.php/$1 [L]

9

0
9|0 | 鲜花 VS 砸蛋 | 30阅读 0评论
下一篇: 亲,OVER了