开发者

How to avoid duplicate content? redirect 301/404?

开发者 https://www.devze.com 2023-02-09 05:30 出处:网络
lets say i have this link: http://www.domain.com/content/view/1/seo-url now, lets say a user misspeled the link -

lets say i have this link: http://www.domain.com/content/view/1/seo-url

now, lets say a user misspeled the link - http://www.domain.com/content/view/1/seo-urll

now, i dont开发者_如何学JAVA want him to get a 404 page, I want to redirect him to the right page with the right seo url, BUT - i dont want to create duplicate content (on google's side).

What to do?

header("....");
header("location: righturl");


You must redirect the user with a 301 (never use 302!) header. You will not get dublicate content problems, and possible linklove goes to the correct url.


303 See Other, I'd say. Either that or a canonical URL in a <meta /> tag.

Actually I'm in doubt since 302 is sometimes referred to as 302 Found [Elsewhere]:

It is an example of industry practice contradicting the standard HTTP/1.0 specification (RFC 1945), which required the client to perform a temporary redirect (the original describing phrase was "Moved Temporarily"), but popular browsers implemented it as a 303 See Other, i.e. changing the request type to GET regardless of what it had been originally. Therefore, HTTP/1.1 added status codes 303 and 307 to disambiguate between the two behaviours.

(wiki)

0

精彩评论

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