Canonical no-www URLs with Rails 3?
开发者_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.
精彩评论