WordPress
Using Permalinks
What are Permalinks?
Permalinks are the permanent URLs to your individual weblog posts, as well as categories and other lists of weblog postings. A permalink is what another weblogger will use to refer to your article (or section), or how you might send a link to your story in an e-mail message. Especially when they are used to link to individual postings, once a story is posted, the URL to it should be permanent, and never change. Hence the "perma" in the name. See Pretty Permalinks for more info.
Structure Tags
You can use these tags to customize your permalinks.
Note on using only %postname%: If you use postname as the only element in your permalinks to create a structure such as myblog.com/post-title, the rewrite rules may make it impossible to access pages such as your stylesheet (which has a similar format) or the wp-admin folder. It's best to include some numeric data (e.g. the post ID or date) in the permalink to prevent this from happening. Additionally, WordPress v1.2.x requires the use of a date structure in order for some features, such as the calendar, to function properly. /archives/%year%/%monthnum%/%day%/%postname%/ is always a good start.
Note on using %category%: %category% does not work correctly with mod_rewrite in Apache versions prior to 2. If you are using Apache 1, do not use %category% in your permalink structure.
Note on using %category% with multiple categories on a post: Where you assign multiple categories to a post, only 1 can show up in the permalink. This will be the lowest numbered category (see manage categories). The post will still be accessible through all the categories as normal.
Properly terminating permalinks: It's important to guarantee permalinks lead
to individual posts within your custom URI, so make sure to end a virtual site structure
with either %post_id% or %postname%
EX: /archives/%year%/%monthnum%/%day%/%postname%/
Editing Rewrite Rules (.htaccess)
This is not required when using WordPress v1.5. WordPress v1.5 creates and/or edits the .htaccess file for you.
Your server must have mod_rewrite for cruft-free permalinks to work. In addition, you must create a .htaccess file and place it in the directory in which your main index.php file resides. For example, if your WordPress blog is installed at domain.com/wordpress/, put the .htaccess file at domain.com/wordpress/.htaccess. However, if your WordPress installation is in a subdirectory, but your visitors access your site at the top level of your domain, place the .htaccess file at domain.com/.htaccess.
When you create a permalink structure, WordPress will generate rewrite rules for you to copy and paste into your .htaccess file.
A few cautions about creating and editing your .htaccess file:
Using Permalinks Without mod_rewrite
For permalinks in general, you must use mod_rewrite, and Windows server do not
support mod_rewrite. If you put a filename at the beginning, WordPress will attempt
to use that to pass the arguments and bypass the necessity for mod_rewrite.
EX: /index.php/archives/%year%/%monthnum%/%day%/%postname%/
If you use this option, you can ignore the rewrite rules (that is, you can ignore .htaccess).
Linking to Permalinks
To link to a permalink from within your site, such as to another post, use the permalink reference from the root of your site directory with a slash on the end such as:
/wordpress/archives/2005/10/01/specific-postname/
The structure of the link is based upon your permalink structure.
To link to a permalink that "leaves" your site and then returns, you will need the full permalink address, such as:
http://www.mysite.com/wordpress/archives/2005/10/01/specific-postname/
Fixing Permalink Problems
Fixing (.htaccess) Generation Issues
If your installation of Wordpress does not generate a .htaccess file or if it does not write the new rules onto your existing .htaccess file then there are a couple reasons that could be causing this. Work step by step and continue to the next step only if the step below does not work.
Fixing Other Issues
If your .htaccess file is being generated correctly, but Permalinks still do not function, you may have one of these problems.
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
If you don't want to set AllowOverride to all (as it is above) then your AllowOverride list must include the FileInfo directive. You must restart your Apache server for any httpd.config file changes to take effect. For more information on which overrides are allowed, read about Apache Core Features (http://httpd.apache.org/docs-2.0/mod/core.html#allowoverride).
More Help
If these steps do not work, search for your problem in the Codex (http://codex.wordpress.com) or in the Support Forum (http://wordpress.org/support/). As a last resort, file a bug report in the Mosquito (http://mosquito.wordpress.org).
Retrieved from "http://codex.wordpress.org/Using_Permalinks"
This page was last modified 09:32, 30 Mar 2005.
Using Permalinks
Table of contents
1 What are Permalinks?
2 Structure Tags
3 Editing Rewrite Rules (.htaccess)
4 Using Permalinks Without mod_rewrite
5 Linking to Permalinks
6 Fixing (.htaccess) Generation Issues
What are Permalinks?
Permalinks are the permanent URLs to your individual weblog posts, as well as categories and other lists of weblog postings. A permalink is what another weblogger will use to refer to your article (or section), or how you might send a link to your story in an e-mail message. Especially when they are used to link to individual postings, once a story is posted, the URL to it should be permanent, and never change. Hence the "perma" in the name. See Pretty Permalinks for more info.
Structure Tags
You can use these tags to customize your permalinks.
Note on using only %postname%: If you use postname as the only element in your permalinks to create a structure such as myblog.com/post-title, the rewrite rules may make it impossible to access pages such as your stylesheet (which has a similar format) or the wp-admin folder. It's best to include some numeric data (e.g. the post ID or date) in the permalink to prevent this from happening. Additionally, WordPress v1.2.x requires the use of a date structure in order for some features, such as the calendar, to function properly. /archives/%year%/%monthnum%/%day%/%postname%/ is always a good start.
Properly terminating permalinks: It's important to guarantee permalinks
lead to individual posts within your custom URI, so make sure to end a virtual site
structure with either %post_id% or %postname%
EX: /archives/%year%/%monthnum%/%day%/%postname%/
Editing Rewrite Rules (.htaccess)
This is not required when using WordPress v1.5. WordPress v1.5 creates and/or edits the .htaccess file for you.
Your server must have mod_rewrite for cruft-free permalinks to work. In addition, you must create a .htaccess file and place it in the directory in which your main index.php file resides. For example, if your WordPress blog is installed at domain.com/wordpress/, put the .htaccess file at domain.com/wordpress/.htaccess. However, if your WordPress installation is in a subdirectory, but your visitors access your site at the top level of your domain, place the .htaccess file at domain.com/.htaccess.
When you create a permalink structure, WordPress will generate rewrite rules for you to copy and paste into your .htaccess file.
A few cautions about creating and editing your .htaccess file:
Using Permalinks Without mod_rewrite
For permalinks in general, you must use mod_rewrite. However, if you put a filename
at the beginning, WordPress will attempt to use that to pass the arguments.
EX: /index.php/archives/%year%/%monthnum%/%day%/%postname%/
If you use this option, you can ignore the rewrite rules.
Linking to Permalinks
To link to a permalink from within your site, such as to another post, use the permalink reference from the root of your site directory with a slash on the end such as:
/wordpress/archives/2005/10/01/specific-postname/
The structure of the link is based upon your permalink structure.
To link to a permalink that "leaves" your site and then returns, you will need the full permalink address, such as:
http://www.mysite.com/wordpress/archives/2005/10/01/specific-postname/
Fixing (.htaccess) Generation Issues
If your installation of Wordpress does not generate a .htaccess file or if it does not write the new rules onto your existing .htaccess file then there are a couple reasons that could be causing this. Work step by step and continue to the next step only if the step below does not work.
If both of these steps do not work, search for your problem in the Codex (http://codex.wordpress.com) or in the Support Forum (http://wordpress.org/support/). As a last resort, file a bug report in the Mosquito (http://mosquito.wordpress.org).
Retrieved from "http://codex.wordpress.org/Using_Permalinks"
This page was last modified 00:18, 22 Feb 2005.