hmans / schnitzelpress

A lean, mean blogging machine for hackers and fools.
http://schnitzelpress.org
MIT License
77 stars 8 forks source link

Enforce canonical post URLs #13

Closed hmans closed 12 years ago

hmans commented 12 years ago

We're already storing a history of slugs for each post, now we should make sure the client is accessing the post by its canonical URL. This allows the blog author to change a post's slug (and therefore URL) without breaking links.

Simply check if the requested slug equals the canonical slug; if not, do a 301 redirect to the post's URL.