301 redirect, canonical question

Posted by Dave on Server Fault See other posts from Server Fault or by Dave
Published on 2011-07-28T18:42:40Z Indexed on 2012/04/16 5:33 UTC
Read the original article Hit count: 269

Filed under:
|

I've designed my own 'latest news' page for my site - and I'm trying to keep the URL's clean.

(eg) It should look like this :

http://www.domain.com/21/this-is-a-clean-url/

When someone links to the article, they sometimes mess it up and do :

http://www.domain.com/21/this-is-a-clean-url/#random-hash-tag

So what I have been doing is looking for "http://www.domain.com/21" and 301 (moved permantly) redirecting to the proper url + adding a canonical meta tag for it.

Is this going overboard?

Should I instead be using a (302 Found) header - and just let the canonical tag tell search engines what the proper URL for the article is?

What is the best way of handling this?

© Server Fault or respective owner

Related posts about http-headers

Related posts about 301