Zeus下配置WordPress Permalinks

时间:2009-12-21 15:11:05   来源:  作者:  点击:次  出处:技术无忧
关键字:zeus WordPress blog

环境:
ZWS 4.3r3 FreeBSD i386 6.1-RELEASE
WordPress 2.0.4

启用 htaccess Support

启用只能让wordpress 实现下面的链接方式.


代码:
http://example.com/index.php/yyyy/mm/dd/post-name/
我想实现这样的链接方式


代码:
http://example.com/yyyy/mm/dd/post-name/
查询了一下wordpress 文档,需要apache mod_rewrite 支持才能实现这种链接方式.

启用 Request Rewriting

在Rewrite Script输入一下代码

 RULE_0_START:
# get the document root
map path into SCRATCH:DOCROOT from /
# initialize our variables
set SCRATCH:ORIG_URL = %{URL}
set SCRATCH:REQUEST_URI = %{URL}

# see if theres any queries in our URL
match URL into $ with ^(.*)\?(.*)$
if matched then
set SCRATCH:REQUEST_URI = $1
set SCRATCH:QUERY_STRING = $2
endif
RULE_0_END:

RULE_1_START:
# prepare to search for file, rewrite if its not found
set SCRATCH:REQUEST_FILENAME = %{SCRATCH:DOCROOT}
set SCRATCH:REQUEST_FILENAME . %{SCRATCH:REQUEST_URI}

# check to see if the file requested is an actual file or
# a directory with possibly an index. don't rewrite if so
look for file at %{SCRATCH:REQUEST_FILENAME}
if not exists then
look for dir at %{SCRATCH:REQUEST_FILENAME}
if not exists then
set URL = /index.php?q=%{SCRATCH:REQUEST_URI}
goto QSA_RULE_START
endif
endif

# if we made it here then its a file or dir and no rewrite
goto END
RULE_1_END:

QSA_RULE_START:
# append the query string if there was one originally
# the same as [QSA,L] for apache
match SCRATCH:ORIG_URL into % with \?(.*)$
if matched then
set URL = %{URL}&%{SCRATCH:QUERY_STRING}
endif
goto END
QSA_RULE_END:
 


回到 WordPress Permalinks 进行相应的设置,就可以实现了.

记录一下,以免自己忘记了
第一次玩Zeus 费了不少周折,谢谢Chocobo的帮助
 

文章评论

共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面

特别推荐