Report this

What is the reason for this report?

vhost is redirecting to another subdomain.

Posted on April 17, 2020

Hello Everyone,

I have a confusing issue configuring vhost in apache on Ubuntu 18.04.

I have this wordpress vhost config:

<VirtualHost *:80>
    ServerAdmin mail@outlook.com
    ServerName blog.mydomain.com
    ServerAlias www.blog.mydomain.com
    DocumentRoot /var/www/blog
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/blog/>
    AllowOverride All
</Directory>

RewriteEngine on
RewriteCond %{SERVER_NAME} =www.blog.mydomain.com [OR]
RewriteCond %{SERVER_NAME} =blog.mydomain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

And then, I have a PHP app in another directory, the vhost config file is:

<VirtualHost *:80>
    ServerAdmin mail@outlook.com
    ServerName subdomain.mydomain.com
    ServerAlias www.subdomain.mydomain.com
    DocumentRoot /var/www/subdomain
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/subdomain/>
    AllowOverride All
</Directory>
</VirtualHost>

I Configured the DNS records. but subdomain.mydomain.com is redirecting me to blog.mydomain.com.

Is there a missconfiguration or something else? (I’m really noob on apache configurations, sorry if it’s stupid.)

Greetings, and stay safe!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.