Change default landing page

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Change default landing page

Post by SavaSC »

Hello,

The default URL for nagiosxi is http://ServerName/NagiosXI. Unfortunately, that means that if you just go to http://ServerName that you then have to click on a link to take you to the \NagiosXI page. Is there any way to redirect traffic directly to the /NagiosXI page? I know how to do this with IIS but not with Apache.

Thanks!
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Change default landing page

Post by bwallace »

This doc will show how to change the landing page:
https://assets.nagios.com/downloads/nag ... g-Page.pdf
Be sure to check out the Knowledgebase for helpful articles and solutions!
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: Change default landing page

Post by SavaSC »

Thank you for your response, but this is not the information I was looking for. I was trying to make it where people were automatically redirected to the log-in page instead of the "click here to get to the log-in page" page. The document you referenced tells how to change what page shows up after a user logs on. I was referring to before they log on.

Incidentally, I figured it out. You have to edit the following file:
/var/www/html/index.php

Somewhere in there (I put it in the header) stick the following code:

Code: Select all

	<?php
	header("Location: http://ServerName.YourCompany.com/nagiosxi/");
	?>
BOOM! No more having to click twice to get to the login page.

This question has been answered. You can close this thread.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Change default landing page

Post by rkennedy »

This will work, but index.php will be overwritten when you update.

I would rewrite this at an apache level rather then PHP, by doing the following:

Modify /etc/httpd/conf.d/nagiosxi.conf and look for -

Code: Select all

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule nagiosxi/api/v1/(.*)$ /usr/local/nagiosxi/html/api/v1/index.php?request=$1 [QSA,NC,L]
</IfModule>
Before the </IfModule>, add this -

Code: Select all

RedirectMatch ^/$ /nagiosxi/
Then restart httpd, and it will redirect / to /nagiosxi/.
Former Nagios Employee
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Change default landing page

Post by gormank »

Home Page Modification in admin manage components seems to be what you're looking for. The http://<nagios fqdn> leads to a page where you click a link to log in. http://<nagios fqdn>/nagiosxi leads to the page defined in components or a login prompt.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Change default landing page

Post by rkennedy »

Thanks @gormank!

@SavaSC - let us know if you have any further questions.
Former Nagios Employee
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: Change default landing page

Post by SavaSC »

gormank wrote:Home Page Modification in admin manage components seems to be what you're looking for. The http://<nagios fqdn> leads to a page where you click a link to log in. http://<nagios fqdn>/nagiosxi leads to the page defined in components or a login prompt.


Unless there is something I'm missing, this doesn't do what I am requesting. This is for after a user logs in, not before.
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: Change default landing page

Post by SavaSC »

rkennedy wrote:This will work, but index.php will be overwritten when you update.

I would rewrite this at an apache level rather then PHP, by doing the following:

Modify /etc/httpd/conf.d/nagiosxi.conf and look for -

Code: Select all

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule nagiosxi/api/v1/(.*)$ /usr/local/nagiosxi/html/api/v1/index.php?request=$1 [QSA,NC,L]
</IfModule>
Before the </IfModule>, add this -

Code: Select all

RedirectMatch ^/$ /nagiosxi/

Then restart httpd, and it will redirect / to /nagiosxi/.
This worked! Thank you so much!
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Change default landing page

Post by mcapra »

Is it alright if we lock this thread and mark the issue as resolved, or did you need additional assistance with the landing page configuration?
Former Nagios employee
https://www.mcapra.com/
SavaSC
Posts: 238
Joined: Wed Feb 23, 2011 4:49 pm

Re: Change default landing page

Post by SavaSC »

You can lock it. Thank you for the assistance.
Locked