Subdomain always redirects to main domain. Why?
6,853
Those wacky configs from /var/www/vhosts/
(looks like they're from Plesk?) are using the full IP as their vhost address declaration, so the *:80
listener won't ever get any requests to that IP. Assuming that you only have that one IP on your server, this isn't desired.
Change the <VirtualHost>
line in your newly created host, to have it be used for requests that hit the Plesk-created name-based vhost:
<VirtualHost 83.169.46.168:80>
ServerName site1.example.com
DocumentRoot "/var/www/vhosts/example/site1"
<Directory /var/www/vhosts/example/site1>
Allow from all
AllowOverride All
</Directory>
</VirtualHost>
![UpCat](https://i.stack.imgur.com/rqeRn.jpg?s=256&g=1)
Author by
UpCat
Updated on September 18, 2022Comments
-
UpCat almost 2 years
when I request
site1.example.com
I get redirected toexample.com
. In/etc/apache2/sites-available/
I have setup asite1.example.de
file with following content<VirtualHost *:80> ServerName site1.example.com DocumentRoot "/var/www/vhosts/example/site1" <Directory /var/www/vhosts/example/site1> Allow from all AllowOverride All </Directory> </VirtualHost>
After
sudo a2ensite site1.example.com
and reloading apache it still redirects me to main domain. Any ideas why?
I use
apache2/2.2.14 (Ubuntu 10.4)
. My server is acting as nameserver.-
ravi yarlagadda about 12 yearsDoes the address displayed in your browser change, or does it stay the same and just send you the content from the main site?
-
UpCat about 12 yearsthe url stays the same but displays the content from the main page
-
ravi yarlagadda about 12 yearsLooks like your new vhost file isn't taking effect - I wonder if your main vhost isn't using the same host/port combination (
*:80
)? Can you provide the output fromapache2ctl -S
?
-