I am having issues as I have 2 sites. Same subdomain, but different domain.
ie:
site.domain1.com
site.domain2.com
Whenever I go to site.domain1.com it forwards to site.domain2.com
Anyone know how to fix this?
I am having issues as I have 2 sites. Same subdomain, but different domain.
ie:
site.domain1.com
site.domain2.com
Whenever I go to site.domain1.com it forwards to site.domain2.com
Anyone know how to fix this?
This is a common issue in CyberPanel where one subdomain redirects to another. The problem is typically caused by either virtual host configuration conflicts or incorrect settings in the domains’ configuration files. Let me provide you with a step-by-step solution:
First, let’s examine the virtual host configuration files for both domains:
bash
# Check the configuration files in the vhost directory
cd /usr/local/lsws/conf/vhosts/
ls -la
Look for the configuration files for both of your domains (site.domain1.com and site.domain2.com).
The most likely cause is a redirect rule in one of the domain configurations or in your .htaccess file. Here’s how to check for them:
bash
# For both domains, check for redirect rules
grep -r "Redirect" /usr/local/lsws/conf/vhosts/site.domain1.com/
grep -r "Redirect" /usr/local/lsws/conf/vhosts/site.domain2.com/
# Also check .htaccess files
cat /home/*/public_html/site.domain1.com/.htaccess
cat /home/*/public_html/site.domain2.com/.htaccess
If the UI approach doesn’t work, you can edit the configuration files directly:
bash
# Edit the vhost conf file for the first domain
nano /usr/local/lsws/conf/vhosts/site.domain1.com/vhost.conf
Look for and remove any lines that contain redirect directives pointing to the other domain, such as:
Redirect permanent / http://site.domain2.com/
RewriteRule .* http://site.domain2.com/ [R=301,L]
If you’re using LiteSpeed (which CyberPanel uses by default), check for rewrite rules:
bash
# Check for rewrite rules
cat /usr/local/lsws/conf/vhosts/site.domain1.com/vhost.conf | grep -i rewrite
cat /home/*/public_html/site.domain1.com/.htaccess | grep -i rewrite
Sometimes SSL configurations can cause redirections:
After making any changes, restart the LiteSpeed web server:
bash
systemctl restart lsws
After making server changes, clear your browser cache to ensure you’re not seeing cached redirects:
Ctrl+Shift+Delete (in most browsers)
If the issue persists, you may need to:
/usr/local/lsws/conf/httpd_config.conf
This should resolve your subdomain redirection issue in CyberPanel, I hope that helps.
Apparently it was the database that had the wrong URL for site name in it.