Subdomain redirecting to main domain

Keywords: WordPress - AWS - Technical issue - Services (Apache, MariaDB, MySQL…)

bnsupport ID: 8cd48e21-3103-4b8e-29a2-8fe3bb790e8b

bndiagnostic output:

? Apache: Found possible issues
? Connectivity: Found possible issues
https://docs.bitnami.com/general/apps/wordpress/administration/use-pagespeed/#disable-pagespeed
https://docs.bitnami.com/general/apps/wordpress/troubleshooting/debug-errors-apache/
https://docs.bitnami.com/bch/apps/moodle/troubleshooting/deny-connections-bots-apache/
https://docs.bitnami.com/general/faq/administration/use-firewall/

bndiagnostic failure reason: The suggested guides are not related with my issue

Description:
Hi Team,
i want to host multiple domain in Bitnami wp.i have reffred this link
https://docs.bitnami.com/aws/apps/wordpress/administration/create-custom-application-php/#approach-b-self-contained-bitnami-installations2
after configuration myapp.runloyal.com is redirecting to main domain www.runloyal.com please help us

Hi @alexander.k

Thanks for using Bitnami WordPress!

I have been reviewing your configuration and it seems that there are some inconsistencies in the Apache configuration file. Apart from that, the guide mentions how to set up the application to be accessible via a subpath, like MAIN-SITE/myapp/. Indeed, it seems this is working properly:

$ curl https://www.runloyal.com/myapp/
This is Vhost Test

If you want to deploy this under a subdomain, please take a look at the following comments:

  1. In order to serve the subsite using a subdomain, you’ll need to set up a new VirtualHost. It seems you have deleted the line that included extra-vhosts files by default in your bitnami.conf file. Please, restore this line at the end of the file:

apache2/conf/bitnami/bitnami.conf

...
#    ProxyPreserveHost On
#    ProxyRequests On
#    ProxyPass / http://172.31.0.58:10009
#    ProxyPassReverse / http://172.31.0.58:10009
#</VirtualHost>
+ # Bitnami applications that uses virtual host configuration
+ Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf"
  1. Prevent myapp to be accessible via subpath:

apache2/conf/bitnami/bitnami-apps-prefix.conf

# Bitnami applications installed in a prefix URL
Include "/opt/bitnami/apps/wordpress/conf/httpd-prefix.conf"
Include "/opt/bitnami/apps/phpmyadmin/conf/httpd-prefix.conf"
- Include "/opt/bitnami/apps/myapp/conf/httpd-prefix.conf"
Include "/opt/bitnami/apps/chat/conf/httpd-prefix.conf"
Include "/opt/bitnami/apps/book/conf/httpd-prefix.conf"
  1. Restart your apache service
$ sudo /opt/bitnami/ctlscript.sh restart apache

Try accessing your site again and see if it works now :slightly_smiling_face:

Best regards,
Jose Antonio Carmona


Was my answer helpful? Click on :heart:

Hi Jose Antonio Carmona,
After made the changes that you have suggested now we are getting Forbidden

You don’t have permission to access this resource.

Hi again!

Could you please share the output of the following command?

$ sudo tail -n30 /opt/bitnami/apache/logs/error_log

Best regards,
Jose Antonio Carmona


Was my answer helpful? Click on :heart:

Additionally, try adding the following line to your /opt/bitnami/apps/myapp/conf/httpd-vhosts.conf file:

#pawops
<VirtualHost *:80>
ServerAdmin root@localhost
ServerName myapp.runloyal.com
...
+ Include "/opt/bitnami/apps/myapp/conf/httpd-app.conf"
</VirtualHost>
<VirtualHost *:443>
ServerAdmin root@localhost
ServerName myapp.runloyal.com
...
+ Include "/opt/bitnami/apps/myapp/conf/httpd-app.conf"
</VirtualHost>

Then, restart the Apache service again:

$ sudo /opt/bitnami/ctlscript.sh restart apache

Best regards,
Jose Antonio Carmona


Was my answer helpful? Click on :heart:

Hi Jose Antonio Carmona, Thanks for your earlier response…Restarted Apache After included

  • Include “/opt/bitnami/apps/phpmyadmin/conf/httpd-app.conf” but still having Forbidden error

I’m sorry there is a typo in my lines!

It should be /opt/bitnami/apps/myapp/conf/httpd-app.conf instead of /opt/bitnami/apps/phpmyadmin/conf/httpd-app.conf ! Notice that it says myapp instead of phpmyadmin.

Could you please change the line and restart again?

Best regards,
Jose Antonio Carmona


Was my answer helpful? Click on :heart:

Thanks Jose Antonio Carmona, Its working now getting SSL error now…Also do i need to create new vhost or directory to access sub1.runloyal.com ,sub2.runloyal.com etc

Thanks Jose Antonio Carmona, Its working now getting SSL error now…

Would you mind opening a new ticket for this? We usually try to have single-themed threads so that users in the community can find answers to specific topics easier. We will be more than happy to provide you with assistance there as well :slightly_smiling_face:

Also do i need to create new vhost or directory to access sub1.runloyal.com ,sub2.runloyal.com etc

If you plan to serve different applications for each of those new domains, you should be creating a new directory and configuration files (with the vhosts) as you did for this one myapp. Also, remember to add a new line to /opt/bitnami/apache/conf/bitnami/bitnami-apps-vhosts.conf to include the new vhosts

Best regards,
Jose Antonio Carmona


Was my answer helpful? Click on :heart: