天天看點

iis php根目錄可以通路子目錄不行,WordPress在iis下僞靜态後子目錄無法通路的解決辦法 - YangJunwei...

WordPress 3.0.4在win2003+IIS6下僞靜态後,無法通路子目錄了,發現隻要是非wp-開頭的子目錄檔案夾,比如檔案夾名為s的子目錄,通過http://yangjunwei.com/s,都會跳轉到404錯誤頁面,相當郁悶!個人的解決方法就是在僞靜态規則中為該子目錄設定一條規則,以下紅色為新增規則,完整規則如下:

[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 /s(.*) /s$1 [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]

其中的 RewriteRule /s(.*) /s$1 [L] 即為子目錄的規則,大意是通路該子目錄時跳轉至該子目錄,而非之前的404頁面,同理,如有多個子目錄,也可設定多條規則

注意:該子目錄規則,也有童鞋說要寫成

RewriteRule /s/(.*) /s/$1 [L]

但經過諾豆網親測,如果規則中子目錄後加個斜杠,當在url裡輸入網址時,子目錄後也必須帶上斜杠,如http://yangjunwei.com/s/,否則還是會跳轉到404頁面!如果你沒出現類似問題,那麼隻要能正常通路,怎麼寫都行!