Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php htaccess目录索引中断对Wordpress的访问?_Php_Wordpress_.htaccess - Fatal编程技术网

Php htaccess目录索引中断对Wordpress的访问?

Php htaccess目录索引中断对Wordpress的访问?,php,wordpress,.htaccess,Php,Wordpress,.htaccess,我在我的目录/博客中安装了wordpress 我最近在.htaccess中添加了这一行 DirectoryIndex /dgroup/index.php 现在我不能再访问博客主页了,我不明白为什么。我甚至尝试手动添加 RewriteRule ^blog/$ blog/index.php 没有结果 可能值得注意的是,我可以从博客访问单个帖子,只是主页被破坏了 有什么想法吗 提前谢谢 更多详情: 我不能再访问博客主页了,我的意思是我得到了一个错误404 我试图实现的只是将dgroup/inde

我在我的目录/博客中安装了wordpress

我最近在.htaccess中添加了这一行

DirectoryIndex /dgroup/index.php

现在我不能再访问博客主页了,我不明白为什么。我甚至尝试手动添加

 RewriteRule ^blog/$ blog/index.php
没有结果

可能值得注意的是,我可以从博客访问单个帖子,只是主页被破坏了

有什么想法吗

提前谢谢

更多详情:

我不能再访问博客主页了,我的意思是我得到了一个错误404


我试图实现的只是将dgroup/index.php作为默认页面

您实际上是在告诉apache“如果在目录中找不到资源,请提供/dgroup/index.php”。您的规则将应用于任何目录

因此,当您浏览到
/blog/post/something
,这些目录不存在,因此apache会说“好吧,这里什么都不存在,所以让我们提供/dgroup/index.php

我对您试图实现的目标有点困惑。如果您只想在有人访问/dgroup时提供/dgroup/index.php,请使用以下命令:

<Directory /dgroup>
    DirectoryIndex index.php
</Directory>

DirectoryIndex.php
dgroup/index.php应该是默认页面

删除
DirectoryIndex
行,并将此规则作为
DocumentRoot/.htaccess
中打开
/dgroup/index.php的第一条规则,同时访问域的主页:

RewriteRule ^/?$ /dgroup/index.php [L]

“现在我再也不能访问博客主页了”——这是什么意思?你想实现什么?dgroup(index.php应该是默认页面,所以当有人访问domainname.com时,应该在那里登陆。顺便说一句,实际上我可以访问/blog/post/something。唯一的问题是博客主页。非常感谢。只是好奇?为什么是[L]flag?它似乎在有和无两种情况下都能工作。我认为它应该告诉你这是最后一条指令,但似乎我错了!
L
表示
last
,这就停止了当前的重写循环注入规则进行进一步处理。在这种情况下,你可能看不到区别,但下面有规则
L可能会影响。