Multiple Permalink Structures
I just found out that it is possible to create multiple “Permalink Structures” in WordPress! This is great if you want to change the structure (i.e. /2005/05/10/multiple-permalink-structures.html), but already have people linking to your articles using the old structure (i.e. /archives/2005/05/10/129/). It’s also good if you have an existing site with a certain structure you want to match as well as making a new custom structure. Here’s how I did it:
- Make a copy of your
.htaccess
file located in the root directory of your blog. - Log in to your blog’s admin area and go to
Options > Permalinks
. - Change the Permalink Structure to your fancy using Permalink tags.
- In WordPress 1.2.2 and below, you will need to open up the
.htaccess
file and manually add the rules
- In WordPress 1.2.2 and below, you will need to open up the
- Open your backup and new
.htaccess
files. - This is the tricky part: Determining what part of your backup to copy to your new file. You may copy all of it, but it isn’t necessary.
- Compare and find what lines of code are different (they will look something like this:
RewriteRule ^archives/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([0-9]+)/trackback/?$ /index.php?year=$1&monthnum=$2&day=$3&p=$4&tb=1 [QSA,L]
). You probably wont need to change the/archives/date/
,/archives/author/
,/archives/categories/
or any lines above those. - copy all needed lines of code from your backup to your new
.htaccess
file making sure to keep it below# BEGIN WordPress
and above# END WordPress
.
- Compare and find what lines of code are different (they will look something like this:
That’s it, have fun!