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

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]

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!

Author: Joel Carnat

@work Technical Architect and SysAdmin ; @home OpenBSD and FOSS, Karate, Kobudō, Jōdō, Bodyweight workout, Photography & Music

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.