开发者

Pretty urls and trailing slashes

The question is about trailing slashes in URLs.

When we have a directory structure, then it is obvious - / means directory, no slash means resource.

However many sites are dynamic and use pretty urls that do not directly reflect their directory structure. And in this case most urls are actually requesting resources rather than directories, so a trailing slash is not needed.

My questions is: is it fine to have pretty urls not ending in a trailing slash, and if access to a trailing slash version is attempted to use a 30开发者_JS百科1 redirect to the non-slash version?

And a counter question - is it fine to have all pretty urls end with a slash even though they are not directories?


Google says it's ok (for indexing and searching and all that)

However, they do mention that behavior like this is treated as duplicate content. So it's probably better that only one of those schemes actually refer to the content. You'd want one of the schemes to redirect to the other. Whether it should be the one with the trailing slash or not depends on your choice.

This article talks about this issue as well : http://www.standardzilla.com/2007/07/09/dont-forget-your-trailing-slash/ It recommends that you end with a trailing slash. But I think this is dependent more on how your server is setup than anything else.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜