WordPress permalinks with Apache

The permalinks have been configured to work with Lighttpd here.

Now, if you want to do it with Apache (here the 1.3.29 OpenBSD patched version), here are the directions.

Enable the rewrite module:

# vi /var/www/conf/httpd.conf
(...)
# rule-based rewriting engine to rewrite requested URLs on the fly
LoadModule rewrite_module       /usr/lib/apache/modules/mod_rewrite.so
(...)

Enable the FollowSymLinks option and FileInfo directives:

# vi /var/www/conf/httpd.conf
(...)
<Directory />
    Options FollowSymLinks
    AllowOverride FileInfo
</Directory>
(...)

An .htaccess file is automagically created when the pretty permalinks are enabled from the WordPress’ admin interface ; if the www user has the right rights on the directory. If not, you can create it yourself:

# vi /var/www/htdocs/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

If you ever wanted to allow WordPress to make modifications to the .htaccess file, you would:

# chown www:www /var/www/htdocs/.htaccess

That’s All Folks!

No Comments

Leave a Reply

%d bloggers like this: