Bizarre Permalinks Issue: 404 Errors Everywhere

First and foremost, this is definitely a duplicate of the age old question of “my WordPress permalinks are generating 404 errors”, but in a way it’s different because no solutions I’ve tried have worked.

A little back-story to my problem:

Read More

I developed a WordPress site locally, all permalinks and everything worked. I installed a new copy of WordPress on the server, imported all of my local posts and everything on the homepage looked great, this is where the greatness ends. None of the permalinks work, the pages, posts (all posts are using custom post types), they all give me the message:

“Not Found
The requested URL /content/we-need-to-talk-about-kevin/ was not found on this server.”

The post type this post belongs to is called: “sketcphad” however I have a rewrite on my register_post_type function that makes it “content” which definitely works locally, so that’s not the issue.

Things that I have tried:

  1. Manually replacing the .htaccess rewrite rules, then deleting it and re-adding it in again
  2. Adding in flush_rewrite_rules() into my functions.php file
  3. Visiting the settings -> permalinks page, then clicking save
  4. Trying another permalink structure (currently it’s /%postname%) I tried a few others to no avail
  5. Tried deleting the content and re-adding it in manually
  6. Tried re-adding in the pages manually

The puzzling thing about this situation is the site works locally, what could be happening on my server to cause these issues? The server is running basically the same LAMP environment with exception my local LAMP environment is using XAMPP on Windows, but I’ve moved plenty of sites from local to a remote server without an issue like this.

What am I not seeing?

See below for my functions.php code that registers the post types.

function sketchpad_posttype()
{
    // Labels for our custom post type
    $labels = array(
        'name' => _x('Content', 'sketchpad'),
        'singular_name' => _x('Content Entry', 'sketchpad'),
        'add_new' => _x('Add New', 'Content Entry'),
        'add_new_item' => __('Add Content Entry'),
        'edit_item' => __('Edit Content Entry'),
        'new_item' => __('New Content Entry'),
        'view_item' => __('View Content Entry'),
        'search_items' => __('Search Content Entries'),
        'not_found' =>  __('Nothing found'),
        'not_found_in_trash' => __('Nothing found in Trash'),
        'parent_item_colon' => ''
    );

    // Arguments that specify how we use our custom post type
    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
        'menu_icon' => get_stylesheet_directory_uri() . '/images/icons/notepad.png',
        'rewrite' => array('slug' => 'content'),
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => null,
        'supports' => array('title','editor', 'thumbnail'),
        'taxonomy' => array('category')
    );

    // Call the register_post_type function and make it official
    register_post_type( 'sketchpad' , $args );
}

function article_posttype()
{
    // Labels for our custom post type
    $labels = array(
        'name' => _x('Articles', 'article'),
        'singular_name' => _x('Article', 'article'),
        'add_new' => _x('Add New', 'Article'),
        'add_new_item' => __('Add Article'),
        'edit_item' => __('Edit Article'),
        'new_item' => __('New Article'),
        'view_item' => __('View Article'),
        'search_items' => __('Search Articles'),
        'not_found' =>  __('Nothing found'),
        'not_found_in_trash' => __('Nothing found in Trash'),
        'parent_item_colon' => ''
    );

    // Arguments that specify how we use our custom post type
    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
        'menu_icon' => get_stylesheet_directory_uri() . '/images/icons/notepad.png',
        'rewrite' => array('slug' => 'article'),
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => null,
        'supports' => array('title','editor','thumbnail'),
        'taxonomy' => array('category')
    );

    // Call the register_post_type function and make it official
    register_post_type( 'article' , $args );
}

// Register our custom post types
add_action('init', 'sketchpad_posttype');
add_action('init', 'article_posttype');

Related posts

Leave a Reply

1 comment

  1. The issue wasn’t caused by WordPress, I found out that my httpd.conf file had a default setting of AllowOverride None which was causing my rewrite rules in my .htaccess file not to work. Probably something I should have checked in the first place, but easy to overlook as well.