• Resolved limekiller

    (@limekiller)


    I have a new blog with only a few posts in it so far. I’ve updated my permalink structure from the default to a custom pattern, my .htaccess file was modified, and I have mod_rewrite enabled in Apache2, however all links, even newly created ones after the change are broken. I expected old posts to be broken until I fixed them individually, but I’m surprised new ones are too. One thing I noticed is that regardless of the permalink structure I choose, the modifications to .htaccess are the same. Is that correct? Is there something else I need to do that I don’t know about yet?

    My permalink structure is /%year%%month%/%postname%.html. So links look like https://www.example.com/wordpress/200905/new_post.html. My apache error log shows “File does not exist: /var/www/wordpress/200905”.

    Help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi,

    As you have updated the permalinks then add this code in the htaccess of your domain..

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    ErrorDocument 404 /index.php?error=404
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    [spam link moderated]

    Thanks,

    Shane G.

    Thread Starter limekiller

    (@limekiller)

    Nope, that doesn’t work either. That’s almost exactly what was created for me when I changed the structure. Here’s what was automatically created.

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

    Adding the ErrorDocument line and taking out the “wordpress” references made no change. I still get a 404 error.

    /%year%%month%/%postname%.html

    this is wrong – should look like this

    /%year%/%month%/%postname%.html

    I would delete the .htaccess in wordpress root and generate a completely new one with this correct structure

    Thread Starter limekiller

    (@limekiller)

    (Note: In my forum post I mistyped and should have typed %monthnum% instead of %month%. My intention was to have something look like …/200905/postname.html rather than /2009/05/postname.html.)

    Nonetheless, I tried your suggestion of putting the extra slash in, and that didn’t work either. I made a post titled “test-post” and clicked “view post” after publishing it. I get an error that says

    Not Found
    The requested URL /wordpress/2009/05/test-post.html was not found on this server.

    I even did a fresh install on a separate computer and get the same error. I’ve verified that .htaccess is being made, and that mod-rewrite is enabled. However, no matter what non-default structure I pick, the .htaccess file is always created identically. So .htaccess is the same whether the structure is set to “/%year%/%monthnum%/%day%/%postname%/” or “/%year%/%monthnum%/%postname%/” or “/monkey/pinata/%postname%/”. I don’t understand that. It seems like .htaccess should change depending on the structure chosen. index.php is referenced in .htaccess and its not changing either. If I change back to default structure, .htaccess empties.

    Is there some file that might need its permissions altered I should look at? I’m running Ubuntu 8.10, Apache2 and WordPress 2.7.1.

    Thread Starter limekiller

    (@limekiller)

    A little more info. I added a custom 404 error document to the .htaccess file and it isn’t loading when I intentionally go to a nonexistent page. So for some reason, it appears .htaccess is being ignored.

    Thread Starter limekiller

    (@limekiller)

    Resolved:
    The problem was that the httpd.conf file was empty. I edited it with:

    <Directory /var/www/wordpress>
        Options FollowSymLinks
        AllowOverride FileInfo
    </Directory>

    and the problem was solved.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Permalink errors with mod_rewrite enabled’ is closed to new replies.