将一个子目录添加到doc root中托管wordpress的站点

时间:2010-05-29 20:07:57

标签: php wordpress

我想从新创建的子目录中运行我的网站上的php脚本。

但是我发现我现有的wordpress博客(从doc root运行)拦截了我在url中的脚本并给了我404.

如何让wordpress忽略子目录?

编辑:基于评论,这是我的.htaccess文件内容:

# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName example.com
AuthUserFile /home/xxx/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/xxx/public_html/_vti_pvt/service.grp
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

2 个答案:

答案 0 :(得分:1)

基于pekka的评论,我用以下内容解决了我自己的问题(其中folder1是我希望wordpress忽略的子目录):

=========[ start of .htaccess snippet]==========
<IfModule mod_rewrite.c>
RewriteEngine on
#
# stuff to let through (ignore)
RewriteCond %{REQUEST_URI} "/folder1/"

# other existing rules go here:
RewriteRule (.*) $1 [L]
#
====================[ end ]=====================

佩卡,如果你把评论作为答案,我会相信你。

由于

答案 1 :(得分:1)

另一种解决方案:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} ^/(stats|failed_auth\.html).*$ [NC]
    RewriteRule . - [L]
</IfModule> 

这个对我很有用。

来源:http://wiki.dreamhost.com/Making_stats_accessible_with_htaccess