Having problem with my subdomain. Did everything by tutorial and now my subdomain is redirected to main domain. I do not have much experience with this kind of stuff so help would be appreciated. And main domain has SSL so maybe that’s the problem or my hover settings for subdomain are wrong?
demo.domain.com.conf
<VirtualHost *:80>
ServerAdmin admin@demo.domain.com
ServerName demo.domain.com
ServerAlias www.demo.domain.com
DocumentRoot /var/www/demo.domain.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
etc/hosts
myIPadress demo.domain.com
Hover domain
@ A myIPadress
* A myIPadress
mail CNAME mail.hover.com.cust.hostedemail.com
@ MX 10 mx.hover.com.cust.hostedemail.com
www CNAME domain.com
www CNAME demo.domain.com
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.
So finally got it right. Now it’s working.
Changed
to
And added
.htaccess
in directoryThe following steps worked for me. 1: add virtual host like the following with chmod 664 and chown www-data:www-data
2:
sudo add-apt-repository ppa:certbot/certbot
(add the repository) 3:sudo apt install python-certbot-apache
(Install Certbot’s Apache package with apt)4: type “
certbot
” 5: select the newly created virtual host 6: and you are all good to go. cheersDid you enabled your VirtualHost? As I see, you created new file for subdomain VH, if you did it - you need to enable it using
a2ensite
:Make sure to restart after any change you do to the config:
Try to access subdomain again. If you still see wrong page, try clearing cache or going to Incognito mode.