Question

domainname.com vs www.domainame.com NOT the SAME

Hi there,

My domainname is not pointing to the same.

  1. www.domainname.com
  2. domainname.com

should point to the same, but these 2 are not.

Any help please to solve this issue ? I appreciate.


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
July 6, 2023

Hello,

The problem you’re experiencing typically occurs due to DNS settings. Here are steps to make both www.domainname.com and domainname.com point to the same place:

  1. Check Your DNS Records: You need to have both an A record and a CNAME record set up.

    • The A record should point domainname.com directly to your server’s IP address.

    • The CNAME record should point www.domainname.com to domainname.com.

    This should be set up in the DNS management tool of your domain registrar or your DNS hosting service.

  2. Set Up Your Web Server to Respond to Both Domains: On your web server, you need to configure your virtual host file to respond to both www.domainname.com and domainname.com. For example, in NGINX, you can set server_name to domainname.com www.domainname.com;. In Apache, you can use ServerAlias www.domainname.com.

Here’s an example of the DNS settings:

Type    Host                 Value
A       domainname.com       IP_Address
CNAME   www                  domainname.com

Replace IP_Address with your actual IP address.

Note: DNS changes may take up to 24-48 hours to propagate across the internet, although it generally happens more quickly.

I hope this helps. Let me know if you have any other questions or need further clarification!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel