This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Default login page redirect.
#1
Default login page redirect.
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.

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'], true301);
    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
Reply
Thanks given by:
#2
RE: Default login page redirect.
.htacess can do the trick too
No support using PM (Auto adding to IGNORE list!), use the forum. 
How to ask

200$ free to start your VPS 60 days credit
Reply
Thanks given by:
#3
RE: Default login page redirect.
(01-29-2016, 06:17 AM)Me.B Wrote: .htacess can do the trick too

Exactly and without editing core panel files Wink
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:
#4
RE: Default login page redirect.
(01-29-2016, 08:59 AM)TGates Wrote:
(01-29-2016, 06:17 AM)Me.B Wrote: .htacess can do the trick too

Exactly and without editing core panel files Wink

Wait what? How would a .htaccess do this?
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
Update redirect to Sentora login to an error page if a sub domain does not exist TGates 3 3 ,809 11-14-2024, 11:49 AM
Last Post: TGates
How can I Overwrite Default Hook? apinto 7 19 ,551 05-10-2015, 02:09 AM
Last Post: Me.B

Forum Jump:


Users browsing this thread: 2 Guest(s)