Wordpress - 找不到管理员

时间:2015-08-03 08:40:07

标签: wordpress

最近出现了一个我正在努力解决的奇怪错误。

我使用子域方法安装了wordpress:

www.example.com/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

我的索引文件:

<?php
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );

home设置为:www.example.com 网址设置为:www.example.com/wordpress

当我尝试访问管理员时:www.example.com/wordpress/wp-admin我收到错误消息:抱歉,找不到您要查找的页面。 < / p>

这不是Wordpress的新安装,这个问题最近才在自动更新后发生。

我如何进行错误测试?

2 个答案:

答案 0 :(得分:2)

您正在使用子目录安装(而不是子安装);因此,您的# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /wordpress/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wordpress/index.php [L] </IfModule> # END WordPress 文件不属于根目录 - 它应该位于您的wordpress/目录中,以及其他安装目录。

此外,您的index.php需要进行修改,以说明它位于子目录中的事实:

__FILE__

您还应该从index.php文件中删除/wordpress/部分。 PHP魔术常量index.php实质上意味着“相对于此文件”,因此,如果您的require( dirname( __FILE__ ) . '/wp-blog-header.php' ); 文件位于Map<String,Person> peopleMap = new Map<String,Person>(); Person person = new Person(); //let's imagine this person has a string id attribute with a get method defined peopleMap.put(person.getId(),person); //adds the person to the list peopleMap.get("p71"); //assume we're looking for a person which id="p71"; ,那么它实际上是'查看/ wordpress / wordpress / for wp-blog -header.php`。

因此,请将public class Person { private String name; private String id; private int age; public String getId() { return this.id; } //other getter/setters and methods you implement } 文件中的该行修改为:

class Country < ActiveRecord::Base
  with_options dependent: :restrict_with_error do
    has_many :airports
    has_many :owners
    has_many :users
  end


  def deletable?
    [Airport, Owner, User].none? { |m| m.exists?(country_id: self.id) }
  end
end

......一切都应该按预期工作。

答案 1 :(得分:1)

对此的修复相对简单。检查apache日志后,我每次尝试访问管理URL时都注意到以下错误:

  

Application.cpp中的SoftException:256:文件   &#34; /home/example/public_html/wordpress/wp-login.php"是可写的   组

此文件的权限设置为:644理论上应该有效。我在Wordpress Codex上读到权限应该是644或640:

https://codex.wordpress.org/Changing_File_Permissions

我将wp-login.php文件更改为640,我的问题已解决。

我认为这个错误不是由于wordpress更新而是由于服务器更新。这可能是Cpanel托管服务器的常见问题。