I have a lightsailt LAMP instance. It uses bitnami and I changed the /opt/bitnami/apache/conf/httpd-vhosts.conf to add a new subdomain.
<VirtualHost *:80>
ServerName newsubdomain.domain.com
ServerAlias newsubdomain.domain.com
DocumentRoot /home/bitnami/test
<Directory /home/bitnami/test/>
Options -Indexes
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/test-error_log"
CustomLog "logs/test-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerName oldsubdomain.domain.com
ServerAlias oldsubdomain.domain.com
DocumentRoot "/opt/bitnami/apache/htdocs"
<Directory /opt/bitnami/apache/htdocs>
Options -Indexes
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/old.com-error_log"
CustomLog "logs/old.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerName SERVER IP
ServerAlias SERVER IP
DocumentRoot /home/bitnami/test
<Directory /home/bitnami/test/>
Options -Indexes
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/ip-error_log"
CustomLog "logs/ip-access_log" common
</VirtualHost>
I also added a new file inside /opt/bitnami/apache/conf/vhosts/ name test-vhost.conf:
<VirtualHost 127.0.0.1:80 _default_:80>
ServerAlias newsubdomain.domain.com
DocumentRoot /home/bitnami/test
<Directory "/home/bitnami/test">
Options -Indexes +FollowSymLinks -MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
When I go to the server ip i get the test index.html but when i go to the new subdomain i get redirected to the old subdomain page.
I restarted apache using the bitnami script, restarted the bitnami daemon completely but going into the new subdomain I can’t get the test page, I only get redirected to the old subdomain page.
Dani Márquez BiG is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.