“Pages” all give 404 errors
-
Using 2.6.1, serving from my own Debian server. At some point, all of my “pages” (i.e., not the posts) stopped working. Instead I get a 404 error for all of them. The posts and everything else seem fine. I’ve tried creating new pages and following the links to them and still I get a 404. I have a standard .htaccess file aside from some extra stuff for Gallery/wpg2 that doesn’t seem to have anything to do with this issue. I’m not even sure how to begin troubleshooting. Apache error log offers no insight. Any recommendations?
-
I just inserted a debug command in build_query_string() in classes.php to see the query_string as it’s being built. When I request the page “about”, the query_string is category_name=about. This seems like possibly the problem — it should be (I believe) name=about, since the page has no category. Does this help at all?
Another interesting data point — if I navigate right to the page_id, e.g.,
https://adam.rosi-kessel.org/weblog/page_id=2, it actually redirects to the correct page (which is /about), but then goes to the 404.
Although I will see what I can find, a Moderator’s perspective would definitely be helpful here. Otto42 are you there?
Please don’t say “Just reinstall everything”. We know that is an option, but we are trying to learn as well.
I’m off to see the wizard! The wonderful wizard of awes!
Did you notice that the pages you can get to are in this format:
https://adam.rosi-kessel.org/weblog/2005/12/15/winter_sunsetAnd the pages you cannot get to are in this format:
https://adam.rosi-kessel.org/weblog/about/So somewhere you have dates enabled, but they were not applied to all pages. Did you switch settings in WP when this problem occurred?
I had a similar problem with an SEF rewrite in Joomla.
Maybe you should research that?
I am not aware of having switched any settings. Obviously something happened because the pages were working before and are not working now; I suspect it was an upgrade, either of the main package or a plugin, but I didn’t notice for a while that the problem was happening, so I haven’t been able to trace it back.
I agree the date thing might be related, but the reason the “about” page doesn’t have a date is that it’s a page, not a post. If I insert the published date for the “about” page:
https://adam.rosi-kessel.org/weblog/2007/01/22/about/
It automatically redirects back to https://adam.rosi-kessel.org/weblog/about/, which is broken.
I do have a permalink migration setting defined for migrating from a pre-WordPress version of my blog; it is ‘%category%/%postname%.html’. As I understand it, this should only be redirected URLs with ‘.html’ at the end, so should not have any effect for the problem discussed here.
I finally found a URL form that works with my current setup:
https://adam.rosi-kessel.org/weblog/index.php?pagename=about
So it seems like what’s happening is https://adam.rosi-kessel.org/weblog/about is getting mapped to category_name=about, where it should really get mapped to pagename=about. I’ve identified the problem but not the solution. Below is the output of my advanced permalinks debug — unfortunately the Advanced Permalinks author provides no support. Any advice here?
Array
(
[robots.txt$] => index.php?robots=1
[.*wp-atom.php$] => index.php?feed=atom
[.*wp-rdf.php$] => index.php?feed=rdf
[.*wp-rss.php$] => index.php?feed=rss
[.*wp-rss2.php$] => index.php?feed=rss2
[.*wp-feed.php$] => index.php?feed=feed
[.*wp-commentsrss2.php$] => index.php?feed=rss2&withcomments=1
[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
[comments/page/?([0-9]{1,})/?$] => index.php?&paged=$matches[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]
[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]
[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})/([^/]+)/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})/([^/]+)(/[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]
[.+?/[^/]+.html/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
[.+?/[^/]+.html/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
[.+?/[^/]+.html/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
[.+?/[^/]+.html/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
[(.+?)/([^/]+).html/trackback/?$] => index.php?category_name=$matches[1]&name=$matches[2]&tb=1
[(.+?)/([^/]+).html(/[0-9]+)?/?$] => index.php?category_name=$matches[1]&name=$matches[2]&page=$matches[3]
[.+?/[^/]+.html/([^/]+)/?$] => index.php?attachment=$matches[1]
[.+?/[^/]+.html/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
[.+?/[^/]+.html/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
[.+?/[^/]+.html/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
[(.+?)/?$] => index.php?category_name=$matches[1]
[.+?/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]
[(.+?)/trackback/?$] => index.php?pagename=$matches[1]&tb=1
[(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?category_name=$matches[1]&feed=$matches[2]
[(.+?)/(feed|rdf|rss|rss2|atom)/?$] => index.php?category_name=$matches[1]&feed=$matches[2]
[(.+?)/page/?([0-9]{1,})/?$] => index.php?category_name=$matches[1]&paged=$matches[2]
[(.+?)(/[0-9]+)?/?$] => index.php?pagename=$matches[1]&page=$matches[2]
[(.+?)/([^/]+).html/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?category_name=$matches[1]&name=$matches[2]&feed=$matches[3]
[(.+?)/([^/]+).html/(feed|rdf|rss|rss2|atom)/?$] => index.php?category_name=$matches[1]&name=$matches[2]&feed=$matches[3]
[(.+?)/([^/]+).html/page/?([0-9]{1,})/?$] => index.php?category_name=$matches[1]&name=$matches[2]&paged=$matches[3]
[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]
)I’ve temporarily fixed the problem by inserting these rewrites before everything else:
RewriteRule ^about index.php?pagename=about [L]
RewriteRule ^pgp-key index.php?pagename=pgp-key [L]
RewriteRule ^randomplay index.php?pagename=randomplay [L]Not ideal but at least the pages are back up.
I am a late comer to this thread and while browsing the pretty long posts… I noticed this:
When I request the page “about”, the query_string is category_name=about.
So, my question is: are you trying to use any kind of trick that would remove the word “category (aka “category base”) from the categories permalinks?
Moshu: I’m not trying to do that. Whether I specify a “category base” or not (leave it blank) under Permalinks options, my “pages” still don’t work. It does seem like the problem is WordPress is improperly detecting the page names as category names, but not sure why.
That, usually happens, when people use a plugin or a hack to remove the word “category” form the URL, e.g. to have
example.com/gizmos
instead of the standard
example.com/category/gizmos(N.B. If you don’t put there anything, WP still adds the word “category”!)
Some people are unhappy with the URL that includes “category” (or any word as category base) and hacking WP to remove it they end up exactly with the problem that WP cannot differentiate between Pages and categories… That was the reason for my question.
I’m not aware of any plugin or hack to remove category; although, testing it now, it does seem to work if I do example.com/gizmos (i.e., it maps to a category). But I don’t know what setting would do that. Any tip for how to trace down the problem?
If it does – you might found the solution. Because on a normal setting it doesn’t:
https://moshublog.com/wordpress-101/ = error
https://moshublog.com/section/wordpress-101/ = works
(on my blog “section” is the category base)Well, I’ve found my problem, but not my solution. How do I track down why the /category/ base is not necessary?
I’d start deactivating ALL the plugins that have even a remote effect on permalinks.
- The topic ‘“Pages” all give 404 errors’ is closed to new replies.