WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Permalinks rewrite OK, but always give 404 when hit (10 posts)

  1. fak3r
    Member
    Posted 7 years ago #

    Just moved to WP a few days ago and really like it, but I'm stuck trying to get permalinks to work. My old site used this format:

    http://fak3r.com/articles/2006/06/21/sample-post/

    And on my webserver I'm still seeing Google and others that are linked to those posts failing, since now all my posts look like:

    http://fak3r.com/?p=94

    I want to do a 301 perm redirect, I go into the Permalinks section, and then choose 'Date and name based' which spits out the line:

    /%year%/%monthnum%/%day%/%postname%/

    Then I either leave it like that, or modify that to (I've tested it both ways):

    /articles/%year%/%monthnum%/%day%/%postname%/

    but both ways it fails. My .htaccess file (also I've tested w and w/o the top Directory Directive, just include it so that we know it's on):

    <Directory />
    Options FollowSymLinks
    AllowOverride All
    </Directory>

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

    But when I hit my site, fak3r.com works, *and* all of the links look rewriten correctly:

    http://fak3r.com/2006/06/20/hello-world/

    So it is rewriting the URLs, but it gives a File not Found, with Apache's errorlog showing:

    [Wed Jun 21 11:08:20 2006] [error] [client xxx.xxx.xxx.xxx] File does not exist: /usr/local
    /www/data-dist/fak3r.com/2006, referer: http://fak3r.com/
    [Wed Jun 21 11:08:23 2006] [error] [client xxx.xxx.xxx.xxx] File does not exist: /usr/local
    /www/data-dist/fak3r.com/2006, referer: http://fak3r.com/
    [Wed Jun 21 11:08:25 2006] [error] [client xxx.xxx.xxx.xxx] File does not exist: /usr/local
    /www/data-dist/fak3r.com/2006, referer: http://fak3r.com/

    So it's failing to find it, since it can't find the '2006' directory - which doesn't exist, but that's what mod_rewrite is supposed to be taking care of.

    I know mod_rewrite works on this server, my last blog was running on a web app so it's external URL (fak3r.com) would come in on the standard http port 90, and then it needed to be converted with mod_rewrite and mod_proxy to point to an internal webapp running on port 3000. What I'm attempting with WP is much simplier, so I can't understand why it's not working. I've searched the Docs and Forums to no avail. I've even recompiled PHP since I had it running as CLI which someone said caused problems, but no change.

    Specs:

    FreeBSD: 6.0-SECURITY
    APACHE: 2.0.58
    MYSQL: 5.1.9
    PHP: 5.1.4
    WORDPRESS: 2.0.3

    Thanks

    f

  2. Oblong_Cheese
    Member
    Posted 7 years ago #

    Having the same problem over at my site too.

    I'm running:

    Linux 2.6.12-gentoo-r6
    Apache/2.0.58
    PHP 5.1.4-pl0-gentoo
    MySQL 4.1.20-log
    Python 2.4.2

    And my apache error_log looks as such:

    [Mon Jun 26 21:18:24 2006] [error] [client 72.30.102.94] File does not exist: /var/www/localhost/htdocs/category<br />
    [Mon Jun 26 21:31:23 2006] [error] [client 68.142.251.66] File does not exist: /var/www/localhost/htdocs/2006<br />
    [Mon Jun 26 22:28:48 2006] [error] [client 207.46.98.139] File does not exist: /var/www/localhost/htdocs/category<br />
    [Mon Jun 26 22:39:13 2006] [error] [client 65.55.235.165] File does not exist: /var/www/localhost/htdocs/2006<br />
    [Mon Jun 26 23:22:29 2006] [error] [client 65.55.235.165] File does not exist: /var/www/localhost/htdocs/feed<br />
    [Tue Jun 27 00:53:56 2006] [error] [client 207.46.98.139] File does not exist: /var/www/localhost/htdocs/lik-sang-banners

    I've recompiled php a few times, reinstalled apache, done everything I can think of. mod_rewrite is loaded and working (presumably -- I don't know how to test it), and my .htaccess file has been written by WordPress.

    Any assistance would be great. I too have searched the forums to no avail. :(

  3. yosemite
    Member
    Posted 7 years ago #

    faker: For giggles, try:
    <Directory /usr/local/www/data-dist/fak3r.com>
    Options FollowSymLinks
    AllowOverride All
    </Directory>

    (if you haven't already).

  4. Oblong_Cheese
    Member
    Posted 7 years ago #

    Doesn't work for me. :(

  5. fak3r
    Member
    Posted 7 years ago #

    Yosemite
    Thanks for the suggestion, but I tried it, same error. This time I pointed to an archieve struction, and my apache error log said:

    [Tue Jun 27 12:50:00 2006] [error] [client xxx.xxx.xxx.xxx] File does not exist: /usr/local/www/data-dist/fak3r.com/archives, referer: http://fak3r.com/

    my .htaccess file looks like this:

    <Directory /usr/local/www/data-dist/fak3r.com>
    Options FollowSymLinks
    AllowOverride All
    </Directory>

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^tags/(.*)$ ?page_id=103&tag=$1
    </IfModule>

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

    I'm really lost here, again, mod_rewrite is installed and working on Apache, and as you can see, WP is sending you to the new URL...

    Thanks for the replies thus far, would be cool if this was just a PHP 5 issue -- perhaps a php.ini setting?

  6. Oblong_Cheese
    Member
    Posted 7 years ago #

    I fixed it.

    You have to change the AllowOverride option in your vhosts.d/00_default_vhost.conf to "All".

    Though my rudimentary knowledge of apache tells me that default vhost configuration shouldn't affect the <Directory /> entries, this appears to have fixed it for me.

    Courtesy of a post over on the Gentoo.org forums: http://forums.gentoo.org/viewtopic-t-465435-highlight-wordpress.html

  7. Oblong_Cheese
    Member
    Posted 7 years ago #

    Aha! Of course, it's due to this line in httpd.conf:

    Include /etc/apache2/vhosts.d/*.conf

    So, disable that if you don't use virtual hosts, and you should be sweet. ;-)

  8. fak3r
    Member
    Posted 7 years ago #

    Hmmm...thanks, that solved it for me, but not in the same way. I added this to my httpd.conf:

    <Directory /usr/local/www/data-dist/fak3r.com>
    Options FollowSymLinks
    AllowOverride All
    </Directory>

    And everything worked! This is what I thought was in .htaccess, but I didn't have the full path called out, just a '/'

  9. DaveVT5
    Member
    Posted 7 years ago #

    Ok, MANY MANY thanks for this Thread! This information needs to be added to the Documentation. Specifically fak3r's comment to add the following to http.conf:

    <Directory /usr/local/www/data-dist/fak3r.com>
    Options FollowSymLinks
    AllowOverride All
    </Directory>

    That was precisely the fix I needed.

  10. Chris_K
    Member
    Posted 7 years ago #

    @DaveVT5 - Permalinks page in the codex definitely mentions AllowOverride. Check the "Fixing Other Issues" section. :-)

Topic Closed

This topic has been closed to new replies.

About this Topic