Changes to permalink structure results in 404 error for all pages other than home

When changing the permalink structure on my site, I get a 404 error for every page except the home page. I’ve see other questions that mention resetting the permalink structure to get it work, but this doesn’t work for me (using the default of ?p=123 does show the posts, but changing back to month and name 2012/03/sample-post/ causes the 404).

With the permalink structure set to month and name, the htaccess file is:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>

# END WordPress

The htaccess file that wordpress updates is in the /etc/wordpress directory and the details are:

-rw-r--r-- 1 www-data root      934 2012-03-10 19:13 htaccess

The index.php file is in the /var/www directory:

<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require('./wordpress/wp-blog-header.php');
?>

Are there other changes I need to make to allow for a change to the permalinks?

Update

This is running on a Linux box I have root access to. I did enable mod_rewrite, but get the same results – the default permalinks work, but changing the structure doesn’t. I also have /wordpress in each URL, like wordpress/?page_id=31 and updating the URL in the WordPress settings doesn’t help. That most likely is a separate issue – I’ll ask separately, but wanted to provide the info in case it’s relevant.

4 Answers
4

Are you wanting the site to render as www.thesite.com/news or www.thesite.com/wordpress/news

If just www.thesite.com/news, try this change:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Leave a Comment