Question

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

Posted May 27, 2014 2k views
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.

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.

×
1 answer
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.

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:


server {
listen 80;
server_name www.your-domain.tld;
return 301 http://your-domain.tld$request_uri;
}

server {
listen 80;
server_name your-domain.tld;
# And whatever else....
}
Submit an Answer