When you get the 404, does it give the ‘expected’ URL? Like http://www.therealsite.com/category/postname ?
Yes I think so. Also when I try to access the pages with their non-clear urls, like ?p=24, it redirects to the clean url. But then I get the 404 from wordpress
Is WP loaded in root or is it in a subfolder and you’re using the ‘trick’ to put it in the root directory with the index.php file?
This trick-> Giving WordPress Its Own Directory requires that you copy your .htaccess from your blog folder to the root folder (which it says, but I didn’t do and screwed myself up for a while).
yes, WP is loaded in root. Not in a subfolder.
I just tried upgrading again, and again I get 404’s on everything other then the home page.
Before upgrading, I did an export from the db using phpmyadmin. I created a new testdomain locally. I imported the db into phpmyadmin locally. I then ran the upgrade from 2.6.5 to 2.7 locally, it works fine.
I really don’t understand what’s going on. I double checked the htaccess, the config, everything. I upgraded at least 10 of my wp sites, all of them working fine. This one, not.
Any other ideas?
Sounds like the .htaccess isn’t actually working.
Yes, it seems like it. I just tested the site without pretty urls (?p=9 etc) and that works. But why the htaccess is not working is not clear. It worked fine before upgrading to 2.7. It works fine if I backgrade to 2.6.5
But now with 2.7 it doesn’t work anymore. I even tried uploading an empty .htaccess file, chmodding to 777, let WP write the file.
Now I tried another thing: I created a complete fresh WP install in a testfolder on the same server. I get the same problem. Permalinks not working, every page/post returns 404
Somehow the problem seems to be an interaction between WP2.7 and the htaccess file. Mod_rewrite and htaccess file alone works, as is shown by the working 2.6.5 install.
Possibly something is still referencing the local site. I guess try the 2.7 again, go into admin – settings – general and change the WordPress address and Blog address and hit save changes – even if they are already correct. Then go through the permalinks starting with default and see if any of them work.
Hi mrmist, thanks for the answer. Unfortunately, after doing what you suggested it still doesn’t work. Even with the completely new install I get the same problem.
I really have no clue here. The database is correct. The fact that a new fresh install has the same problem proves that it doesn’t have to do with the database of the current site. The fact that a previous wordpress version 2.6.5 and earlier have no problems getting clean urls, proves that htaccess and clean urls do work on the webhost. So it seems to be some interaction betweenwp 2.7 and the webhost. But what?
following this thread in hopes of an answer. I have the same problem, even on a test server running 2.5. No plugins, just an out of the box installation.
The results are the same with WP, versions 2.5 through 2.7, on Apache 2.2 and php5 with MySQL 5 on either FreeBSD or OS X.
Categories don’t work (they never have, for some reason).
I have some development in this issue: the webhost of the website changed a field in the wp_options table and that made the clean urls work. It’s the field rewrite_rules, one of the first lines:
From:
a:71:{
s:12:”robots.txt$”;
To:
a:71:{
s:11:”robots.txt$”;
I have no clue what this does, but it has something to do with apache. I’m trying to find out what it does, and whether this is a real fix or if the real problem lies in the configuration of the server.
Ok I am running out of ideas. To see if it is to do with the redirection, you could try putting this on as a plugin –
<?php
/*
Plugin Name: Disable Canonical URL Redirection
Description: Disables the "Canonical URL Redirect" features of WordPress 2.3 and above.
Version: 1.0
Author: Mark Jaquith
Author URI: http://markjaquith.com/
*/
remove_filter('template_redirect', 'redirect_canonical');
?>
If the plugin above does or does not work, it may be worth raising a bug on the trac, with this thread referenced, as it is looking like a 2.7 difference.
That plugin didn’t help either, unfortunately. What I did discover, was that the line of the rewrite rules I mentioned, seems to be incorrect after upgrading. I did a db dump before and after an upgrade from wp2.6.5 to 2.7 and noticed this diference:
Before:
INSERT INTO wp_options VALUES(636, 0, ‘rewrite_rules’, ‘a:256:{s:11:”robots.txt$”; // … line continues
After:
INSERT INTO wp_options VALUES(653, 0, ‘rewrite_rules’, ‘a:304:{s:12:”robots.txt$”; // … line continues
I don’t know what this all means, but to me from looking at the file it seems that the s:12 is supposed to be the count of the characters after it, between the quotes. And that count is 11 before (correct), but 12 after upgrade (incorrect).
When I manually (in phpmyadmin) change the 12 to 11, the clean urls work. However, if I then go into the wp admin panel and do a save for the permalinks, it gets changed back into 12 again and the clean urls stop working again.
So it seems that something goes wrong in the upgrade of that db table
Could have something to do with magic_quotes, that setting can add slashes making that field one char longer.