【问题标题】:.htaccess in public_html blocks Wordpress blogpublic_html 中的 .htaccess 阻止 Wordpress 博客
【发布时间】:2014-10-19 20:35:36
【问题描述】:

我在 public_html 文件夹中有一个 .htaccess,内容如下:

RewriteBase /

DirectoryIndex index3.php

RewriteRule    ^faq/?$    faq.php    [NC,L]
RewriteRule    ^privacy/?$    privacy.php    [NC,L]
RewriteRule    ^blog/?$    blog.php    [NC,L]

以下行阻止安装在我的站点中的 wordpress 博客:

DirectoryIndex index3.php

我的意思是,每当我转到http://mywebsite.net/blog/wp-admin/ 时,都会收到此错误:

您无权访问此服务器上的 /blog/wp-admin/。

在 /public_html/blog/.htaccess 中还有另一个 .htaccess 文件,其中包含以下内容:

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


# END WordPress

我该如何解决这个问题?奇怪的是我不记得修改了什么,这一切都是突然发生的。

文件夹结构

public_html
   index.php
   index3.php
   faq.php
   privacy.php
   blog
     wp-admin
     wp-content
     wp-includes
     .htacces
     index.php

【问题讨论】:

  • 删除第一个 .htaccess 文件中的博客规则...
  • 这没有帮助。删除 DirectoryIndex index3.php 行会有所帮助,但这显然是不可能的。
  • 将其更改为DirectoryIndex index.php 成功了,但我不知道为什么?这是一个奇怪的世界。

标签: php wordpress .htaccess


【解决方案1】:

如果您的 Wordpress 站点安装在 user/public_html/blog/,那么您不希望将其重写为 blog.php。这将阻止您访问/blog/wp-admin.php

RewriteRule    ^blog/?$    blog.php    [NC,L]

如果我理解正确,这行可能是您的问题。请说明更多您尝试使用 .htaccess 文件完成的工作。

【讨论】:

  • 那行应该被注释掉了,对不起。没有 blog.php,因为我在 mywebsite.com/blog 下运行 wordpress 博客。所以这不是解决方案
猜你喜欢
  • 1970-01-01
  • 2014-04-13
  • 2012-02-14
  • 2013-07-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-07-26
相关资源
最近更新 更多