# 403s and 404s served as 404 via React error page (full installs)
ErrorDocument 403 /nagiosxi/error.php
ErrorDocument 404 /nagiosxi/error.php

<Directory "/usr/local/nagiosxi/html">
   ErrorDocument 402 /nagiosxi/ModSecurity.php
   ErrorDocument 504 /nagiosxi/504.php
#  SSLRequireSSL
   Options None
   AllowOverride None
   Require all granted
#   AuthName "Nagios XI"
#   AuthType Basic
#   AuthUserFile /usr/local/nagiosxi/etc/htpasswd.users
#   Require valid-user
</Directory>

Alias /nagiosxi "/usr/local/nagiosxi/html"

# Special configuration to allow .htaccess in custom includes
<Directory "/usr/local/nagiosxi/html/includes/components/custom-includes">
    AllowOverride All
    Options None
</Directory>

# Special config to deny access to deployment
<Directory "/usr/local/nagiosxi/html/config/deployment">
    AllowOverride All
    Options None
</Directory>

# Special config to deny access to nocscreen audio uploads
<Directory "/usr/local/nagiosxi/html/sounds">
    AllowOverride All
    Options None
</Directory>

<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]
RewriteRule nagiosxi/api/v2/(.*)$ /usr/local/nagiosxi/html/api/v2/index.php [QSA,NC,L]
</IfModule>

<If "%{REQUEST_METHOD} in { 'OPTIONS', 'HEAD', 'TRACK' }">
    Require all denied
</If>
TraceEnable off