当htaccess存在时,wordpress站点忽略子目录

当htaccess存在时,wordpress站点忽略子目录,wordpress,.htaccess,directory,subdirectory,Wordpress,.htaccess,Directory,Subdirectory,首先,我没有设置我目前正在工作的网站,我对wordpress的设置不是很熟悉。我在他们的网站上打电话给他们,向这个使用Wordpress配置的网站添加一个管理部分。如果我添加一个子目录,我可以通过web访问子目录。当我为验证目的向该子目录添加.htaccess时,问题就出现了。当我这样做,并试图访问子目录,它的错误,以'页未找到' 有人能帮忙吗?我假设它与下面提供的Wordpress.htaccess文件有关: # BEGIN WordPress <IfModule mod_rewrite

首先,我没有设置我目前正在工作的网站,我对wordpress的设置不是很熟悉。我在他们的网站上打电话给他们,向这个使用Wordpress配置的网站添加一个管理部分。如果我添加一个子目录,我可以通过web访问子目录。当我为验证目的向该子目录添加.htaccess时,问题就出现了。当我这样做,并试图访问子目录,它的错误,以'页未找到'

有人能帮忙吗?我假设它与下面提供的Wordpress.htaccess文件有关:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

我刚刚根据你的问题测试了一个设置。以下是我在您的帖子中收集到的层次结构示例:

public_html/ (all WP install files here)
public_html/admin/ (here I created a new folder similar to your question)
public_html/admin/index.php (test file - just echos a line of text)
public_html/admin/.htaccess (currently blank)
因此,从WP根目录派生的新子目录中的my.htaccess是空的。我不确定那里会有什么样的东西。如果我访问“website/admin/”-测试行回音很好。我没有看到任何404


您能否提供更多的细节,以便我能够更好地复制您看到的问题?

在其他地方找到了解决我问题的方法。编辑root.htaccess(适用于wordpress)以匹配以下内容应该可以修复任何遇到此问题的人:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/NameOf_Directory_ToAllow/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/NameOf_AdditionalDirectory_ToAllow/(.*)$ [OR]
RewriteRule ^.*$ - [L]
</IfModule>

<IfModule mod_rewrite.c>
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
#开始WordPress
重新启动发动机
重写基/
RewriteCond%{REQUEST_URI}^/NameOf_Directory_ToAllow/(.*)$[或]
RewriteCond%{REQUEST_URI}^/NameOf_AdditionalDirectory_ToAllow/(.*)$[或]
重写规则^.*$-[L]
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress

感谢您的回复。不幸的是,它又做了同样的事情。我刚刚设置了一个名为sphere的新目录,当我在没有htaccess的情况下设置它时,它在转到www.site.com/sphere目录时运行良好。但是,当添加htaccess时,它再次出错。下面是sub dir中的htaccess:
AuthType基本AuthName“Sphere”AuthUserFile“my_htpasswd/path”需要有效的用户
btw您的回答有助于确定是sub dir htaccess文件中的某个特定内容将其丢弃,而不是.htaccess文件本身的存在。谢谢你的帮助!
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/NameOf_Directory_ToAllow/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/NameOf_AdditionalDirectory_ToAllow/(.*)$ [OR]
RewriteRule ^.*$ - [L]
</IfModule>

<IfModule mod_rewrite.c>
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress