So I've noticed that the default page for any domain that is directed to your Sentora server results on the login page. I'm not sure if there is a better solution as to how to make it so your default page is not the login but for those who would rather that I made a total bodge to bypass this.
It's really not the best bit of code I've ever written but I thought I would share it. I'm sure that this might inspire someone else to have an idea that would result in better code. What this script does is it compares the TLD that it was accessed from and it compares it to the string defined (our panel url). If it matches it does nothing but if it doesn't match, it removes the first subdomain from your url and redirects you to it. For example:
Access it from: bad.url.example.www.example.com
redirects to: url.example.www.example.com
then to: example.www.example.com
then to: www.example.com
Anyway I just thought I'd share.
Cheers!
--Blake
PHP Code:
//located in /etc/sentora/panel/index.php inserted on line 15
if($_SERVER['SERVER_NAME']!='sentora.example.com'){
$toA = explode('.', $_SERVER['SERVER_NAME']);
array_shift($toA);
return header("LOCATION: http://".implode('.', $toA).$_SERVER['REQUEST_URI'], true, 301);
exit();
}
It's really not the best bit of code I've ever written but I thought I would share it. I'm sure that this might inspire someone else to have an idea that would result in better code. What this script does is it compares the TLD that it was accessed from and it compares it to the string defined (our panel url). If it matches it does nothing but if it doesn't match, it removes the first subdomain from your url and redirects you to it. For example:
Access it from: bad.url.example.www.example.com
redirects to: url.example.www.example.com
then to: example.www.example.com
then to: www.example.com
Anyway I just thought I'd share.
Cheers!
--Blake