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:

Read More
# 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.

Related posts

Leave a Reply

4 comments

  1. You need mod_rewrite support on your Server. Make sure your Server supports mod_rewrite and it’s enabled. If you’ve access to the Root of your Server, you can enable mod_rewrite from Apache’s httpd.conf file. Open this file in any plain text editor and find following line:

    LoadModule rewrite_module modules/mod_rewrite.so
    

    Make sure this line is not commented, that means make sure this line DOES NOT look like this:

    #LoadModule rewrite_module modules/mod_rewrite.so
    

    If so, remove the first “#” character and save this file. Restart your Server and try your Permalink again. It should work.

    If it still doesn’t work for you then it might be due to FrontPage Extensions. Have you installed FrontPage Extensions recently? If so, remove those; I’ve faced the same issue before and it appeared to be caused by FrontPage Extensions. Once you remove those, go to your WordPress Admin and disable Permalink (restore it back to ?p=000 structure. Then, delete your .htaccess file from WordPress (and from the Root as well, if WordPress is not installed at your Root). Go back to your Wordperss Admin and set new Permalink as you like it to be… see if it works this time.

    I hope this information helps. Let us know if either of these solutions helped you to resolve your issue. 🙂

    Cheers,

    Ruturaj.

  2. In your question you posted this:

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

    Apache looks at a file called .htaccess which is not present in your filesystem.

    Rename htaccess -> .htaccess

  3. In my case:

    1. “AllowOverride FileInfo” instead of “AllowOverride None” for www folder.
    2. Uncomment “LoadModule rewrite_module modules/mod_rewrite.so” (remove “#” symbol).

    It works!