Report this

What is the reason for this report?

Adding www to wordpress domain.

Posted on January 17, 2017

Hi, I currently have my domain from GoDaddy pointed to digitalocean without the www before it. Do I just delete the domain without the www and add it again with the www? Is that all or should I change the url settings in wordpress first? I’m afraid I won’t be able to access the website if I change the domain on digitalocean before changing the url settings in wordpress. I should still be able to access the wp-admin by using the ipaddress/wp-admin correct?

Thanks for your help!



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.

@jamief04101d42510041f1f785

For your domain to be accessible using domain.com and www.domain.com, a few things need to be setup. The first is your DNS and the second is your web server.

Your DNS is the easiest, so we can start there. To get started, login to your domain registrars website or, if you’re using DigitalOcean to host your DNS, login to DigitalOceans Control Panel and navigate to the Networking page and click on your domain to pull up your DNS records.

Once ready, you should have the following entries.

A        domain.com        DROPLET_PUBLIC_IP
A        www.domain.com    DROPLET_PUBLIC_IP

Simply replace domain.com with your real domain and DROPLET_PUBLIC_IP with the IP address of your Droplet.

Once your DNS is setup, you need to double-check your web servers configuration and make sure it’s configured to accept both. The configuration will differ depending on whether you’re using Apache or NGINX.

For Apache, your VirtualHost block should look like:

<VirtualHost *:80>
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com
</VirtualHost>

For NGINX, your Server Block should look like:

server {
    server_name domain.com www.domain.com
}

Of course, the above is just snippets and not full VirtualHost or Server Blocks. Simply make the needed changes to the lines that correspond to yours.

Once the above changes are made, you’ll need to restart Apache or NGINX:

service apache2 restart

or

service nginx restart

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.