My subdomain showing me main website?

Im trying to create a subdomain and the main domain is a wordpress site!

Whenever i try to configure as shown in digitalocean tutorials and same in all other tutorials to create a subdomain, my subdomain shows me the content of my main domain.

Eg: my main domain is “” and i want to create “” but it shows me my root site

I edit the vhosts as per the tutorials but still no luck, take a look vhost file:

<VirtualHost *:80> ServerAdmin ServerName DocumentRoot /var/www/

    <Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined


Please someone help me, im trying this from weeks! Appreciate your help!

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


The Vhost looks correct. What you might be missing is:

  • First make sure that the file permissions and ownership in the /var/www/ folder are setup correctly so that the Apache user has read and write access to the files
  • Then as this is a wordpress website, make sure to run a search and replace for your database for to be replaced with (you could do that for both http and https)
  • Then check your .htaccess file and make sure that there are no redirects there

Note: of course before running the search and replace make sure to backup your database in case anything goes wrong!

Hope that this helps! Bobby