开发者

Canonical no-www URLs with Rails 3?

开发者 https://www.devze.com 2023-03-13 09:25 出处:网络
开发者_C百科What do you think about this solution? The idea is to make the no-www version as the canonical one. So we simply strip out the \'www.\' from the request url:

开发者_C百科What do you think about this solution? The idea is to make the no-www version as the canonical one. So we simply strip out the 'www.' from the request url:

!= '<link rel="canonical" href="' + request.url.gsub(/www\./, '') + '" />'

Any problems?


Take a look at Rack Canonical Host. I think it does exactly what you are looking for.

0

精彩评论

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

关注公众号