WordPress Permalinks
The simple Apache configuration that WordPress suggests for use with Permalinks doesn’t always work. If you’re seeing strange behavior, you may be having interactions with other redirect configurations.
The solution is to specify the permalink URLs more precisely in RewriteRule matches.
This configuration assumes the standard “Day and Name” permalink setting for articles, and WordPress’ default category base:
- http://your-domain-here/2008/05/21/some-post-title
- http://your-domain-here/category/some-category-name
To enable permalinks through the WordPress 2.5 admin panel ( very similar to WordPress 2.3 ):
- http://your-domain-here/wp-admin
- Log in as admin
- Select “Settings”
- Select “Permalinks”
- Check “Day and Name”
You may select other formats so long as the mod_rewrite entry ( below ) matches the format you choose
- Leave “category base” and “tag base” settings blank for defaults of ‘/tag/’ and ‘/category/’
- Click “Save”
If the default .htaccess configuration WordPress suggests on that admin page doesn’t work then give mod_rewrite more specific patterns for matching incoming permalink requests.
# "RewriteBase" allowed only within .htaccess files.
# Comment it it out if you're putting this into
# httpd.conf or file included therein.
RewriteBase /
# Take default WordPress permalink URL and
# redirect back to WordPress /index.php with
# named parameter to retrieve story by name
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/[0-9]{4}/[0-9]{2}/[0-9]{2}/([\-_0-9a-z\/]+) /index.php?name=$1 [L]
# Ditto, but for categories.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /category/.* /index.php?category=/$1 [L]
Tags: apache, apache configuration, configuration, mod rewrite, modrewrite, permalink, wordpress