[wp-hackers] permalinks trailing slash good or bad?

Lynne Pope lynne.pope at gmail.com
Thu Jan 29 15:09:11 GMT 2009


2009/1/30 <jidanni at jidanni.org>

>
> Shall I employ a trailing slash on a custom format?
> I would rather not: looks like "through my carelessness in filling out
> the WordPress custom permalinks entry box, I will cause 1000 users to
> have to hit one extra character."


WP allows users to choose their own URL structure and doesn't try to impose
anything on users.

You should read, "Cool URI's dont change"
http://www.w3.org/Provider/Style/URI

The general rule of thumb is this - always use a trailing slash on a URI
that points to a directory, eg. http://example.com/mydirectory/ or
http://example.com/ to cut down server processing time.

While you can use a trailing slash on a file, its not advisable. You would
not, for example, write http://example.com/page.php/ and dropping the file
extension makes no difference to how the URI is written. Files do not have a
trailing slash, only directories do.

Because of the way WP does its URL rewriting its not really a problem no
matter which permalink structure you use - as long as you are consistent
throughout your site. The main reason for avoiding using a trailing slash on
the end of file names (postname etc) is for future-proofing. As it says in
the "Cool URI's dont change" article, your URI's should stay the same no
matter what application you are using for your content. If you wanted to
convert your WP site to, say, a static HTML site, or to a different content
management system you won't want your links to all disappear. Not all apps
can handle a trailing slash on file names (since this is usually reserved
for directories) but all can handle the file extension (eg. .php, .html,
etc) being rewritten so it doesn't display.

Hope this helps.

Lynne


More information about the wp-hackers mailing list