To WWW or not to WWW

To WWW or not to WWW - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the To WWW or not to WWW error on your web browser. Problem :


I'm getting ready to deploy my Rails app. Currently whether you browse to it using www.domain.com or just domain.com you get the same site.



I'm pretty new at this, so I'm looking for some wisdom from experienced web app developers:



Is it worth forcing requests to either WWW or non-WWW? It seems there are apps that go either way...



I know that this kind of question is in danger of being too subjective, but to help keep it objective here's a few specific questions that I'd really appreciate answers to:




  1. Does your web app force requests to WWW or root domain, or does it allow both equally?

  2. What technical reasons are there for choosing one option or the other (honestly I don't know if it even makes a difference).

  3. If you were building a new web app today, which option would you choose?



I appreciate any advice.



--EDIT--



To reiterate what I'm looking for as distinct from this question are there specific ramifications for web applications that I should be aware of before I make a decision and deploy? In particular if any Rails developers have had issues related to one option or the other that would be really helpful to know.


Solution :

Use www as the default one and force redirect to www with this htaccess script:



RewriteEngine on
RewriteCond %HTTP_HOST !^www.WEBSITE.com$
RewriteRule ^(.*)$ http://www.WEBSITE.com/$1 [R=301]


This way you avoid duplicate content on Google.




  1. I don't currently have an active one, but if I had, I would allow both, but redirect from www to simply http://

  2. there is a difference, see https://serverfault.com/questions/145777/whats-the-point-in-having-www-in-a-url

  3. I would make the non-www the default, but would redirect if somebody requested the www one.



edit I wasn't aware of the DNS issue.


We hope that this article has helped you resolve the redirects, ruby-on-rails, no-www error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=