Wednesday, April 20, 2011

Deny access when a false category is given

I have a website with items that can be divided into categories (items have one, not like tags).

This gives me URL's like http://example.com/tutorials/12/Do-nice-things. However, the category and title in the URL are for SEO-purposes, I don't need them, just the ID. It would also work with http://example.com/somethingwrong/12/Foobar.

Now, the question is: Should I check that the given category and title match the actual properties of the item, and show a 404 if the URL is wrong?

Keep in mind that the category and URL can be changed.

From stackoverflow
  • Yes, otherwise people may link to multiple versions of the same thing, and to search engines it will look like duplication.

  • People can change the category and/or title of items, which will break existing links. However, I don't really want people to be able to use just anything, so I've chosen to do a redirect to the correct URL.

    p.s. should this be a permanent or temporary redirect? permanent, i think

0 comments:

Post a Comment