Report this

What is the reason for this report?

Without www my sites workes fine, without I can't login with my username and password.

Posted on May 27, 2014

Hello,

When I log in to my site WITHOUT www. it works fine, but whenever I visit the site with www. the same username and password don’t seem to work. I added www as a A record in the DNS, without it I could even only visit the website without www.

It’s hosted on Ubuntu 14.04 and the application is written in Ruby on Rails.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Right, to access www.your-domain.tld you need to set up either an A record or CNAME pointing to it. Your password issue is perplexing though. I’m having a hard time imagining what would cause that! I’d suggest redirecting the www subdomain back to the main one, as it’s usually a good idea to pick one or the other either way. <br> <br>Since you’re using Rails, I imagine you’re also using Nginx? Edit your configuration to add a new server block that sets up a redirect from www to the root domain. It would look something like: <br> <br><pre> <br>server { <br> listen 80; <br> server_name www.your-domain.tld; <br> return 301 http://your-domain.tld$request_uri; <br>} <br> <br>server { <br> listen 80; <br> server_name your-domain.tld; <br> # And whatever else… <br>} <br></pre>

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.