Virtual host for subdomain doesn't work

Hello everyone. :) I’m a little puzzled right now. I’ve tried to setup a Virtual host for my subdomain “”. Because I need it for community software, as WordPress is already served by my main domain “”.

So I’ve followed this tutorial :

Required folder is created in var/www, with the same name as the subdomain. (

When needed, I’ve created a new conf file in etc/apache2/sites-available :

code<VirtualHost *:80>
DocumentRoot /var/www/
<Directory "/var/www/">
AllowOverride All
ErrorLog ${APACHE_LOG_DIR}/error.log

I think the setup is correctly done, but when I try to access the Public folder of my forum CMS with my browser, (, I got a redirection on my main WordPress page. The same when I just try to reach the root of my subdomain.

Apache2 rebooted and Virtual host enabled with a2ensite prompt.

DNS A record for subdomain is registered. (And actually works fine.)

Droplet was created with a Wordpress image already preinstalled.

So I wonder where is the potential issue ? Thanks ! :)

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.

Your rewrite logic for (/var/www/.htaccess) is likely not checking if the actual subpage/subfolder you’re browsing ( or even is a real directory. So add this at the top of your mod_rewrite rules if you don’t have it:

RewriteCond %{REQUEST_FILENAME} !-d

This way WordPress doesn’t think it needs to send that request to index.php.