Forum Moderators: phranque

Message Too Old, No Replies

Wordpress, permalinks, .htaccess * mod rewrite

         

Jakobud

8:21 pm on Dec 13, 2009 (gmt 0)

10+ Year Member



I've got a thread going on the Wordpress forums about this but I would imagine folks here could figure it out much quicker.

I have a CentOS server that is running my clients website. I was putting together a basic Wordpress site to replace theirs.

When setting the permalinks to be something other than the default, like "Month and Name" (http://wordpress.example.com/2009/12/sample-post/), Apache doesn't seem to want to rewrite the urls for me. I end up getting 404 errors.

Here is my .htaccess:

Options FollowSymLinks
AllowOverride All
# 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

Note: Between the BEGIN and END Wordpress, that part was automatically written by Wordpress based off of the Permalink type I choose. So I can't image that Wordpress wrote out what it needed incorrectly... This leads me to believe that the problem lies somewhere in my Apache configuration.

Checking httpd.conf I see that I do have mod rewrite loaded. PHP's phpinfo(); also confirms that I have Apache's mod_rewrite loaded.

If you click on News or About or something like that, the permalink should end up being something like this:

http://wordpress.example.com/news/
or
http://wordpress.example.com/about/

But Wordpress gives a 404 instead.

The Wordpress installation is the default setup with no plugins loaded and using the default theme.

Anyone got any ideas or experience in this area? I really have no idea what I'm missing here. I'm taking over basic tech/admin stuff for a former employee and I have no idea what kind of weird Apache/PHP configuration setup he has going on this server.

[edited by: jdMorgan at 12:57 am (utc) on Dec. 14, 2009]
[edit reason] No URLs, please. See TOS, [/edit]

jdMorgan

1:03 am on Dec 14, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The first thing I'd look at is that Options directive: You've enabled SymLinks, but turned everything else off. This will likely have some negative side-effects, some inderectly-related to your problem.

I'd recommend the following settings and syntax:

 Options +FollowSymLinks -MultiViews -Indexes 

- or just
 Options +FollowSymLinks -MultiViews 

if it's your intent to allow directory listings on your site.

If you're so inclined, take a look at all of the possible settings for Options in the Apache Core documentation for your server version.

Hopefully, fixing the Options will help, because it does appear that you've got a bog-standard WP mod_rwrite rule there. There are several improvements that can be made to that code, but that's a secondary issue to getting what you currently have there working as expected.

Jim

[edited by: jdMorgan at 10:41 pm (utc) on Dec. 14, 2009]

Jakobud

10:23 pm on Dec 14, 2009 (gmt 0)

10+ Year Member



I figured out the problem. The previous admin didn't have AllowOverrides enabled for Apache for the web directory. So the .htaccess wasn't even getting read to begin with. No wonder I was having such a hard time.

Thanks for the help