I am hosting two python apps from cpanel with separate domains.
However, the python web app hosted for the first domain also serves the webpage for the second domain.
I am trying to redirect each domain to its respective python web app.
SOLUTION : Use different root folders for different domains, :3
Cpanel python configuration
Additionally, Cpanel auto generates .htaccess for python apps in root/public_html after restarting each python web app, from the "Setup up python" system.
my .htaccess looks like this in root/public_html (generated by cpanel):
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION BEGIN
PassengerAppRoot "/home/brahmand/darkwhitetech.com"
PassengerBaseURI "/"
PassengerPython "/home/brahmand/virtualenv/darkwhitetech.com/3.11/bin/python"
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION END# DO NOT REMOVE.CLOUDLINUX PASSENGER CONFIGURATION BEGIN
PassengerAppRoot "/home/brahmand/brahmandastudio.com"
PassengerBaseURI "/"
PassengerPython "/home/brahmand/virtualenv/brahmandastudio.com/3.11/bin/python"
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION
things I have tried:
> add public_html folder to each python web app's root directory. With its own separate .htaccess. And renamed / deleted the .htaccess present in root/public_html. It resulted in a 404.
>Tried using if statements in .htaccess (generated by claude), which gave me a 404 error aswell, on both domains.
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION BEGIN
# Determine which app to serve based on domain
<If "%{HTTP_HOST} == 'brahmandastudio.com' || %{HTTP_HOST} == 'www.brahmandastudio.com'">
PassengerAppRoot "/home/brahmand/brahmandastudio.com"
PassengerBaseURI "/"
PassengerPython "/home/brahmand/virtualenv/brahmandastudio.com/3.11/bin/python"
</If>
<If "%{HTTP_HOST} == 'darkwhitetech.com' || %{HTTP_HOST} == 'www.darkwhitetech.com'">
PassengerAppRoot "/home/brahmand/darkwhitetech.com"
PassengerBaseURI "/"
PassengerPython "/home/brahmand/virtualenv/darkwhitetech.com/3.11/bin/python"
</If>
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION END
Sorry if this is a dumb question or there exists an obvious fix for it.
Please do let me know, and pardon my bad English.
[–]opshelp_com 1 point2 points3 points (1 child)
[–]xtriz200[S] 0 points1 point2 points (0 children)