解决WORDPRESS在IIS下伪静态后子目录无法访问的问题

近几日想给博客加上一些别的页面,自然要用到子目录。没想到访问所有非WP-开头的子目录内容都显示:哦!您要找的日志可能已经更换地址,重新搜索一下吧,或者点击这里回首页看看吧(估计是都转到404页面去了)。看样子WP还真有的高深莫测,令我丈二和尚摸不着头脑啊,后找了不少资料才基本解决此问题,方法是修改伪静态规则文件httpd.ini:
原文内容是:
[ISAPI_Rewrite]

# Defend your computer from some worm attacks
#RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]

# 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 /software-files/(.*) /software-files/$1 [L]
RewriteRule /images/(.*) /images/$1 [L]
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]

如果需要某个子目录(比如本博需要增加tools子目录),则在# Rules to ensure that normal content gets through行下增加如下内容:
RewriteRule /tools/(.*) /tools/$1 [L]

就这样,基本上可以解决此问题。或许还有更好的方法,继续摸索中……也欢迎大家共享。

转载自互联网~具体地址没记~

1 Comments
Leave a Reply

Time limit is exhausted. Please reload the CAPTCHA.