这个问题一直困扰我到现在,今天心血来潮做了一个 jQuery + css 的 Tooltips 效果(小闇那抄来的),想挂到根目录下的Demo文件夹下,打算以后就存放这样的演示独立页。
但问题是根目录下除了WordPress的文件,其他文件/文件夹都无法打开。一开始以为是插件的原因,关闭所有插件,依旧无法打开。于是我就怀疑是 url rewriter 的问题,检查了 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]
# 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]
上面说为了抵御部分病毒进攻,而把非 WordPress 文件设置为无法打开。所以只要在下面添加一条 RewriteRule 就能让你需要的文件/文件夹顺利访问:
RewriteRule /demo/(.*) /demo/$1 [L]
顺便说下,如果你使用 WLW 无法配置成功,也有可能是因为 url rewriter 配置文件问题,你可以看看 httpd.ini 或者 .htaccess 文件是否配置正确,如果是 httpd.ini,只要添加一句:
RewriteRule /xmlrpc.php /xmlrpc.php [L]
» 转载请注明来源 » IM路人 » httpd.ini 配置导致根目录部分文件无法访问







这个没看懂。
iis 下httpd这样的写法,碰到数字开头的地址无法访问。不知道是为什么。还有汉字转成编码也不不行。默认的.htaccess都可以。这是为什么?
@兵者帅
数字开头是指?文件夹是数字?汉字编码是不行,所以我把固定链接改为英文,我也不知道什么原因,可能是win主机本身的原因吧,只能凑合着用吧
分类别名,也就是路径了,不过文章和页面已经解决了,就是分类不行。
@兵者帅
哦,有空去研究下,呵呵
文件夹下的倒是可以了,但是文件还是不行,比如TXT和HTML都打不开。。。
@夏末の伤
如果是文件的话,加:
RewriteRule /xx.txt /xx.txt [L]你再试试看
我按照你说的设置后还是无法访问跟目录的文件 其他都正常
@残阳
你的主机是否是win主机?