So I am having an issue where on my webserver if you go to wwww.mydomain.com it works and displays the website, but if you go to mydomain.com it doesn't change or redirect you to www.mydomain.com, so people can be on mydomain.com and www.mydomain.com and they act like different websites, you have to login to both seperately if you login with the wwww and then click a link that has www you have to login again. Its like they are 2 independent websites with the exact same everything. Is it possible to force them to be the same thing? redirect or change some records? Thanks for any info.

Currently my DNS setup is, I have A record @ pointing to my elastic IP. and www CNAME points to @

closed as off-topic by Jenny D, mdpc, Katherine Villyard, dawud, Ward Jun 27 '14 at 5:38

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is dedicated to professional system and network administrators. End user and enthusiast questions are off-topic (contact your system administrator or hire a professional to help you out). Please see the Help Center for more information." – mdpc, Katherine Villyard, dawud, Ward
If this question can be reworded to fit the rules in the help center, please edit the question.


First and foremost, it's usually recommended that you replace your "domain.com" hosting to be a permanent and visible redirect to "www.domain.com".

Usually, it's done either inside your web panel or in your webserver's configuration file with something similar to that (apache2 example) :

<Virtualhost *:80> 
  ServerName domain.com
  RewriteEngine On 
  RewriteRule ^/(.*)$ http://www.domain.com$1 [R=301,L] 

regarding your login issue, it's likely a cookie problem. If your application is setting a cookie to authenticate your user, this cookie is limited to a fully qualified domain name or a wildcard.

  • a cookie with a limit of domain.com means "only send this cookie when accessing a page on domain.com"
  • a cookie with a limit of .domain.com (mind the dot) means "only send this cookie when accessing a page on domain.com or anything.domain.com"

If you set your application to send a cookie with .domain.com as a domain limiter, it will work both on domain.com and www.domain.com

Not the answer you're looking for? Browse other questions tagged or ask your own question.