Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've read in several places that you should decide whether you want trailing slashes or no trailing slashes in your site URLs and stick to your choice consistently.

This makes sense, but which should I pick? Is there a convention I ought to follow, performance to be gained, or is it totally up to my taste?

(I notice that the StackExchange sites link without trailing slashes, but SE doesn't redirect if you add a slash.)

share|improve this question
    
Doesn't look like it. serverfault.com/questions doesn't redirect anywhere (I see it shortens it just for display purposes). –  Matthew Flaschen Jun 1 '12 at 15:36
    
Oh, I see. All their site links have prefer the missing slash, but they don't redirect if you put one in manually. –  jnm2 Jun 1 '12 at 15:38

2 Answers 2

It doesn't matter - Pick one and stick with it.

With websites like the Stack Exchange network (and most modern sites with dynamic content) the URL is passed to software that does "things and stuff" with it to produce the page you see -- the URL should be formatted in a way that makes that back-end software happy.

The only case I can think of where the trailing slash matters is Apache's mod_dir "Trailing slash redirect", where leaving off the / on a directory results in a redirect (and thus a second HTTP request from the client). The mod_dir documentation explains why, and the consequences of not doing this, quite well.
If that extra HTTP request is a serious concern for you you may want to give this more thought, but it probably isn't a big deal these days.

share|improve this answer

It's really up to you. I would go for the trailing slash, but that is just me. Google also seem to be going for it. A lot of times people may quote your site and forget to but the slash, but an extra redirect every now and then won't be much of an issue.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.