Forums

permalinks don't work following migration from .com (6 posts)

  1. SteveRawlinson
    Member
    Posted 4 months ago #

    I know there are loads of posts here with a similar title but none have solved my issue. I've migrated a site from wordpress.com. All is fine except that permalinks are not working.

    The apache rewrites are definitely working because the 404 comes from WP not the apache server (and if I remove the .htaccess file I get a 404 from apache). The contents of .htaccess have been written by WP.

    I have permalinks set to 'day and name' in settings. The slug is being written to post_name in the wp_posts table. Links to posts provided by WP are being constructed properly. But WP can't find the post when I click the link. Looking at the mysql queries WP performs it does not even look for the slug in post_name (although it does look for it in wp_terms.slug and it's not there).

    One of the queries looks a bit odd to me although this might be a read herring:

    SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND 0 = 1 AND wp_posts.post_type = 'post' AND ...

    Clearly 'where 0 = 1' is never going to return anything.

    Any help much appreciated.

  2. SteveRawlinson
    Member
    Posted 4 months ago #

    A bit more information: I am expecting to be able to get to a post using a url like this:

    http://example.com/2012/01/19/test-post/

    Looking at the internals, build_query_string() is creating this query:

    category_name=01/19/test-post

    ... and I get a 404.

  3. esmi
    Theme Diva & Forum Moderator
    Posted 4 months ago #

    But WP can't find the post when I click the link.

    Is the .htaccess file being updated correctly? Also check with your hosts that mod_rewrite is running on your server.

  4. SteveRawlinson
    Member
    Posted 4 months ago #

    Yes, it's being updated properly, and yes mod_rewrite is working. If it wasn't I'd be getting 404s from apache rather than from WP.

  5. esmi
    Theme Diva & Forum Moderator
    Posted 4 months ago #

    Not necessarily. It definitely sounds like a rewrite issue to me.

  6. SteveRawlinson
    Member
    Posted 4 months ago #

    If the apache rewrite were not working WordPress would not even get the request. I have proved this by deliberately removing the .htaccess file to see what happens.

    Also, build_query_string() is clearly getting my request URL, it's just processing it in a way that WP is apparently looking for a category rather than a post_name.

    I realise that most permalink problems are down to apache rewrites not working but I promise that's not the case in this instance - WP is definitely getting passed the request.

Reply

You must log in to post.

About this Topic

Tags