Pages 404 in wordpress

时间:2013-09-19 作者:Joren

首先,我对wordpress很陌生,对它几乎一无所知。

当我在wp admin中使用创建页面foo时,我会收到一条消息,即页面已创建。当我点击view page, 它是404。我已经按照http://codex.wordpress.org/Pages#Creating_Pages, 但很明显我错过了什么。

我让Wordpress重建我的.htaccess, 但还是没有运气。

System specifications:

Installed Wordpress Plugins:

<调试这个我自己的(空)插件

.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

"Debug This" output for query -> rewrite

Current Rewrite

Matched Rule: 
Matched Query: 
Query String: debug-this=rewrites

Rewrite Rules

Rule    Rewrite
dating_user/?$  index.php?post_type=dating_user
dating_user/feed/(feed|rdf|rss|rss2|atom)/?$    index.php?post_type=dating_user&feed=$matches[1]
dating_user/(feed|rdf|rss|rss2|atom)/?$ index.php?post_type=dating_user&feed=$matches[1]
dating_user/page/([0-9]{1,})/?$ index.php?post_type=dating_user&paged=$matches[1]
category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$ index.php?category_name=$matches[1]&feed=$matches[2]
category/(.+?)/(feed|rdf|rss|rss2|atom)/?$  index.php?category_name=$matches[1]&feed=$matches[2]
category/(.+?)/page/?([0-9]{1,})/?$ index.php?category_name=$matches[1]&paged=$matches[2]
category/(.+?)/?$   index.php?category_name=$matches[1]
tag/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$    index.php?tag=$matches[1]&feed=$matches[2]
tag/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ index.php?tag=$matches[1]&feed=$matches[2]
tag/([^/]+)/page/?([0-9]{1,})/?$    index.php?tag=$matches[1]&paged=$matches[2]
tag/([^/]+)/?$  index.php?tag=$matches[1]
type/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$   index.php?post_format=$matches[1]&feed=$matches[2]
type/([^/]+)/(feed|rdf|rss|rss2|atom)/?$    index.php?post_format=$matches[1]&feed=$matches[2]
type/([^/]+)/page/?([0-9]{1,})/?$   index.php?post_format=$matches[1]&paged=$matches[2]
type/([^/]+)/?$ index.php?post_format=$matches[1]
dating_user/[^/]+/attachment/([^/]+)/?$ index.php?attachment=$matches[1]
dating_user/[^/]+/attachment/([^/]+)/trackback/?$   index.php?attachment=$matches[1]&tb=1
dating_user/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$   index.php?attachment=$matches[1]&feed=$matches[2]
dating_user/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$    index.php?attachment=$matches[1]&feed=$matches[2]
dating_user/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$    index.php?attachment=$matches[1]&cpage=$matches[2]
dating_user/([^/]+)/trackback/?$    index.php?dating_user=$matches[1]&tb=1
dating_user/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$    index.php?dating_user=$matches[1]&feed=$matches[2]
dating_user/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ index.php?dating_user=$matches[1]&feed=$matches[2]
dating_user/([^/]+)/page/?([0-9]{1,})/?$    index.php?dating_user=$matches[1]&paged=$matches[2]
dating_user/([^/]+)/comment-page-([0-9]{1,})/?$ index.php?dating_user=$matches[1]&cpage=$matches[2]
dating_user/([^/]+)(/[0-9]+)?/?$    index.php?dating_user=$matches[1]&page=$matches[2]
dating_user/[^/]+/([^/]+)/?$    index.php?attachment=$matches[1]
dating_user/[^/]+/([^/]+)/trackback/?$  index.php?attachment=$matches[1]&tb=1
dating_user/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$  index.php?attachment=$matches[1]&feed=$matches[2]
dating_user/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$   index.php?attachment=$matches[1]&feed=$matches[2]
dating_user/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$   index.php?attachment=$matches[1]&cpage=$matches[2]
gn-genre/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$   index.php?taxonomy=gn-genre&term=$matches[1]&feed=$matches[2]
gn-genre/([^/]+)/(feed|rdf|rss|rss2|atom)/?$    index.php?taxonomy=gn-genre&term=$matches[1]&feed=$matches[2]
gn-genre/([^/]+)/page/?([0-9]{1,})/?$   index.php?taxonomy=gn-genre&term=$matches[1]&paged=$matches[2]
gn-genre/([^/]+)/?$ index.php?taxonomy=gn-genre&term=$matches[1]
gn-location-3/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$  index.php?taxonomy=gn-location-3&term=$matches[1]&feed=$matches[2]
gn-location-3/([^/]+)/(feed|rdf|rss|rss2|atom)/?$   index.php?taxonomy=gn-location-3&term=$matches[1]&feed=$matches[2]
gn-location-3/([^/]+)/page/?([0-9]{1,})/?$  index.php?taxonomy=gn-location-3&term=$matches[1]&paged=$matches[2]
gn-location-3/([^/]+)/?$    index.php?taxonomy=gn-location-3&term=$matches[1]
gn-location-2/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$  index.php?taxonomy=gn-location-2&term=$matches[1]&feed=$matches[2]
gn-location-2/([^/]+)/(feed|rdf|rss|rss2|atom)/?$   index.php?taxonomy=gn-location-2&term=$matches[1]&feed=$matches[2]
gn-location-2/([^/]+)/page/?([0-9]{1,})/?$  index.php?taxonomy=gn-location-2&term=$matches[1]&paged=$matches[2]
gn-location-2/([^/]+)/?$    index.php?taxonomy=gn-location-2&term=$matches[1]
gn-location-1/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$  index.php?taxonomy=gn-location-1&term=$matches[1]&feed=$matches[2]
gn-location-1/([^/]+)/(feed|rdf|rss|rss2|atom)/?$   index.php?taxonomy=gn-location-1&term=$matches[1]&feed=$matches[2]
gn-location-1/([^/]+)/page/?([0-9]{1,})/?$  index.php?taxonomy=gn-location-1&term=$matches[1]&paged=$matches[2]
gn-location-1/([^/]+)/?$    index.php?taxonomy=gn-location-1&term=$matches[1]
robots\\.txt$    index.php?robots=1
.*wp-(atom|rdf|rss|rss2|feed|commentsrss2)\\.php$    index.php?feed=old
.*wp-app\\.php(/.*)?$    index.php?error=403
.*wp-register.php$  index.php?register=true
feed/(feed|rdf|rss|rss2|atom)/?$    index.php?&feed=$matches[1]
(feed|rdf|rss|rss2|atom)/?$ index.php?&feed=$matches[1]
page/?([0-9]{1,})/?$    index.php?&paged=$matches[1]
comments/feed/(feed|rdf|rss|rss2|atom)/?$   index.php?&feed=$matches[1]&withcomments=1
comments/(feed|rdf|rss|rss2|atom)/?$    index.php?&feed=$matches[1]&withcomments=1
search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$    index.php?s=$matches[1]&feed=$matches[2]
search/(.+)/(feed|rdf|rss|rss2|atom)/?$ index.php?s=$matches[1]&feed=$matches[2]
search/(.+)/page/?([0-9]{1,})/?$    index.php?s=$matches[1]&paged=$matches[2]
search/(.+)/?$  index.php?s=$matches[1]
author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ index.php?author_name=$matches[1]&feed=$matches[2]
author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$  index.php?author_name=$matches[1]&feed=$matches[2]
author/([^/]+)/page/?([0-9]{1,})/?$ index.php?author_name=$matches[1]&paged=$matches[2]
author/([^/]+)/?$   index.php?author_name=$matches[1]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$   index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$    index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$   index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]
([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$    index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]
([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$ index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]
([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$    index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]
([0-9]{4})/([0-9]{1,2})/?$  index.php?year=$matches[1]&monthnum=$matches[2]
([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$ index.php?year=$matches[1]&feed=$matches[2]
([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$  index.php?year=$matches[1]&feed=$matches[2]
([0-9]{4})/page/?([0-9]{1,})/?$ index.php?year=$matches[1]&paged=$matches[2]
([0-9]{4})/?$   index.php?year=$matches[1]
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/?$  index.php?attachment=$matches[1]
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/trackback/?$    index.php?attachment=$matches[1]&tb=1
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$    index.php?attachment=$matches[1]&feed=$matches[2]
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ index.php?attachment=$matches[1]&feed=$matches[2]
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$ index.php?attachment=$matches[1]&cpage=$matches[2]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$   index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&tb=1
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$   index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$    index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/page/?([0-9]{1,})/?$   index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&paged=$matches[5]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/comment-page-([0-9]{1,})/?$    index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&cpage=$matches[5]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$   index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&page=$matches[5]
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$ index.php?attachment=$matches[1]
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/trackback/?$   index.php?attachment=$matches[1]&tb=1
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$   index.php?attachment=$matches[1]&feed=$matches[2]
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$    index.php?attachment=$matches[1]&feed=$matches[2]
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$    index.php?attachment=$matches[1]&cpage=$matches[2]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/comment-page-([0-9]{1,})/?$    index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&cpage=$matches[4]
([0-9]{4})/([0-9]{1,2})/comment-page-([0-9]{1,})/?$ index.php?year=$matches[1]&monthnum=$matches[2]&cpage=$matches[3]
([0-9]{4})/comment-page-([0-9]{1,})/?$  index.php?year=$matches[1]&cpage=$matches[2]
.?.+?/attachment/([^/]+)/?$ index.php?attachment=$matches[1]
.?.+?/attachment/([^/]+)/trackback/?$   index.php?attachment=$matches[1]&tb=1
.?.+?/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$   index.php?attachment=$matches[1]&feed=$matches[2]
.?.+?/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$    index.php?attachment=$matches[1]&feed=$matches[2]
.?.+?/attachment/([^/]+)/comment-page-([0-9]{1,})/?$    index.php?attachment=$matches[1]&cpage=$matches[2]
(.?.+?)/trackback/?$    index.php?pagename=$matches[1]&tb=1
(.?.+?)/feed/(feed|rdf|rss|rss2|atom)/?$    index.php?pagename=$matches[1]&feed=$matches[2]
(.?.+?)/(feed|rdf|rss|rss2|atom)/?$ index.php?pagename=$matches[1]&feed=$matches[2]
(.?.+?)/page/?([0-9]{1,})/?$    index.php?pagename=$matches[1]&paged=$matches[2]
(.?.+?)/comment-page-([0-9]{1,})/?$ index.php?pagename=$matches[1]&cpage=$matches[2]
(.?.+?)(/[0-9]+)?/?$    index.php?pagename=$matches[1]&page=$matches[2]
我还验证了Apache的mod_rewrite 模块已安装并启用。

apache2.conf (comments removed):

LockFile ${APACHE_LOCK_DIR}/accept.lock

PidFile ${APACHE_PID_FILE}

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 5

<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

<IfModule mpm_worker_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

<IfModule mpm_event_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

AccessFileName .htaccess

<Files ~ "^\\.ht">
    Order allow,deny
    Deny from all
    Satisfy all
</Files>

DefaultType None


HostnameLookups Off

ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel warn

Include mods-enabled/*.load
Include mods-enabled/*.conf

Include ports.conf

LogFormat "%v:%p %h %l %u %t \\"%r\\" %>s %O \\"%{Referer}i\\" \\"%{User-Agent}i\\"" vhost_combined
LogFormat "%h %l %u %t \\"%r\\" %>s %O \\"%{Referer}i\\" \\"%{User-Agent}i\\"" combined
LogFormat "%h %l %u %t \\"%r\\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

Include conf.d/

Include sites-enabled/

Include /etc/phpmyadmin/apache.conf

6 个回复
最合适的回答,由SO网友:s_ha_dum 整理而成

像Manish一样,我认为问题在于AllowOverride.

以下内容基于Debian服务器。如果你不知道的话,Ubuntu是基于Debian的。

在您的apache2/ 目录,您应该有sites-available/ 和asites-enabled/ 目录

禁用您的网站a2dissitesites-available/ 包括AllowOverride 指令启用站点a2ensite.以下内容基于在我的开发服务器上沙盒安装当前WordPress的y条目:

# Apache configuration

Alias /wp_release /path/to/site/files

<Directory /path/to/site/files>
    AllowOverride FileInfo
    DirectoryIndex index.php
    Allow from All
    <IfModule mod_php5.c>
        AddType application/x-httpd-php .php

        php_flag magic_quotes_gpc Off
        php_flag track_vars On
        php_flag register_globals Off
        php_value include_path .
    </IfModule>

</Directory>
这是来自一个无法访问公共互联网的开发网站(我可能在某个时候做了一些实验)。您可能不希望在生产服务器上实现这一点,但关键部分是:

    AllowOverride FileInfo
    DirectoryIndex index.php
参考号:http://httpd.apache.org/docs/current/mod/core.html#allowoverride

SO网友:user1145009

你能做的事情很少。。

1) 您可以通过转到wp admin中的permalinks选项卡并简单地重新保存permalink结构来重置permalink数组。

导航到:WordPress仪表板→ 设置→ Permalinks: 单击“Save Changes”.

2) 接下来,使用调试器查看重写数组,并确认负责处理URL的重写规则不存在。为此,请安装插件Debug This, 这样可以很容易地查看WordPress重写数组中的实际内容。

安装并激活此插件后,请访问您的网站。然后导航到:

主页→ 管理栏→ Debug ThisQuery → 重写。

试试这个,让我们知道它会产生什么错误。。

还有第三件事,我发现一些SEO插件中的冲突设置造成了缺页问题。

作为您使用的SEO插件。。我建议停用它并检查。。

作为SEO插件的替代品,您可以使用All In One SEO. 它工作得很好,除非配置错误。

SO网友:fisicx

Wordpress对帖子而不是页面进行分类。

无论如何,你做事情的方式是错误的。如果要创建类别,请转到:

外观>帖子>类别

把他们安置在那里。或者使用帖子编辑器右侧的类别管理器。

SO网友:Lance Cleveland

第一步是简化。禁用所有插件并将您的主题设置回默认的内置主题,如213。报告所发生的情况。

如果创建和查看页面再次开始工作,您就会知道这是一个插件或主题问题。一次激活一个,直到您发现哪一个正在破坏功能。

如果基本WordPress安装和默认主题仍然不起作用,则存在服务器配置或域名/主机名配置问题。确保查看页面的URL正确,并且与您期望的相符。如果没有,请检查WordPress中的常规设置。

SO网友:Nizam Kazi

删除。htaccess文件转到“设置”>“永久链接”,将永久链接类型更改为当前类型以外的任何类型,保存将创建新内容的更改。htaccess,希望它的格式能像WordPress喜欢的那样!

SO网友:Manish

我从上面了解到的是你有。htaccess文件和写入同一文件的正确代码,但仍然存在404问题。让我告诉你为什么。您的服务器不允许。htaccess文件以读取或覆盖权限。那么你怎么能给这个许可呢?打开Apachehttpd.conf 文件服务器AllowOverride 现在你可以看到它出现了好几次。在同一文件中检查以下注释:

 # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None
只需更换AllowOverride None 通过AllowOverride All

现在重新启动APACHE 它应该会起作用

结束

相关推荐

IS_PAGE和WP_REDIRECT的问题

我使用cookies来确定我应该在我的网站上使用哪个菜单。这很好,但如果有人直接查看URL,而不是通过带有查询字符串(被重定向)的URL,我想强制使用正确的方法。换句话说,URL www.yourdomain。com/?region=阿联酋被重定向到www.yourdomain。com/uae/和我希望当新访问者(没有cookie)单击指向www.yourdomain的直接链接时,能够显示相同的结果。com/阿联酋/我不能对init使用钩子,因为我使用的是is\\u page()函数。add_action