Cyberpanel – redirect domain name to another including URLs

Cyberpanel wouldn’t let me forward emails used on an add-on domain, so I had to create a separate website for the add-on domain, create my emails I needed there, and then redirect the content from the “add-on” domain to the correct domain.

For some reason, I was struggling to find the correct code to have in my .htaccess that would work not just for the index page but for all other URLs on the website.  Ultimately, I found a solution that worked:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !newdomain.com$ [NC]
RewriteRule ^(.*)$ https://www.newdomain.com/$1 [L,R=301]

For whatever reason, the other examples I had seen online that claimed to work to redirect a domain name to another domain were not working.  Usually, the index home page did redirect, but not the other URLs.  The above code worked for me in openlitespeed on a Cyberpanel server.

I’m not sure what the problem is with forwarding emails from an add-on domain, but I saw someone else had posted the same issue on the Cyberpanel forums, and there was no solution posted.  I figured it was easier to just avoid using an add-on domain.

Leave a Reply