Getting www.mydomain to redirect to mydomain?
This must be a common question, but apparently I keep doing the wrong thing. I’m a new developer on a project, and the way the app was set up, a user can open ourproject.com and www.ourproject.com in two different tabs and run two different sessions - say, s/he starts with a tab open to ourproject.com, logs in and browses for a while, if s/he then opens another one to www.ourproject.com it won’t know that s/he’s logged in and will prompt him/her to do it again. What we would like is for both www.ourproject.com and ourproject.com to resolve to the same place, so that, whichever the user types in, the www would effectively be either stripped or appended (doesn’t even much matter which) before the page loads, so the two are identical.
When I came on board there was a CNAME record set to www/@. I deleted that, and added one for */@, but all that’s done is make so a user could now have an infinite number of sessions open by inventing arbitrary prefixes. I have now deleted that, but it seems like what that means is www.ourproject.com is going to stop working, which isn’t great either, obviously - people tend to add www’s to the fronts of domain names even when they’re not needed, and we don’t want those people to get an error page.
We’re registered with Enom, and have the name servers there pointing to Digital Ocean’s. The only thing I know about the project on the server side is that we’re running Ubuntu and Unicorn.
What am I missing?
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.