#
# example apache config for PNP4nagios
#

<IfDefine PNP4NAGIOS>
 Alias /pnp  /usr/share/pnp
 <Directory /usr/share/pnp>
    Options None
    AllowOverride None
    order allow,deny
    allow from all
    AuthType Basic
    AuthUserFile  /etc/nagios/htpasswd.users
    AuthName "Nagios Access"
    #    AuthGroupFile /etc/nagios/htpasswd.group
    #    Require group nagios    
    Require valid-user
    # sad to say, but currently necessary:
    php_admin_flag safe_mode off

    <IfModule mod_rewrite.c>
        # Turn on URL rewriting
        RewriteEngine On
        Options FollowSymLinks
        # Installation directory
        RewriteBase /@PKG_NAME@/
        # Protect application and system files from being viewed
        RewriteRule ^(application|modules|system) - [F,L]
        # Allow any files or directories that exist to be displayed directly
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        # Rewrite all other URLs to index.php/URL
        RewriteRule .* index.php/$0 [PT,L]
    </IfModule>

 </Directory>

 # This SSL configuration is ignored if
 # "SSL" is not defined, or if "NOSSL" is defined.
 <IfDefine SSL>
  <IfDefine !NOSSL>
   <IfModule mod_ssl.c>

    SSLEngine on
    SSLOptions +StdEnvVars

    Alias /pnp/ /usr/share/pnp

    <Directory /usr/share/pnp>
      Options None
      SSLRequireSSL
      order allow,deny
      allow from all
      AuthType Basic
      AuthUserFile  /etc/nagios/htpasswd.users
      AuthName "nagios"
      #    AuthGroupFile /etc/nagios/htpasswd.group
      #    Require group nagios
      Require valid-user
      # sad to say, but currently necessary:
      php_admin_flag safe_mode off

    <IfModule mod_rewrite.c>
        # Turn on URL rewriting
        RewriteEngine On
        Options FollowSymLinks
        # Installation directory
        RewriteBase /@PKG_NAME@/
        # Protect application and system files from being viewed
        RewriteRule ^(application|modules|system) - [F,L]
        # Allow any files or directories that exist to be displayed directly
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        # Rewrite all other URLs to index.php/URL
        RewriteRule .* index.php/$0 [PT,L]
    </IfModule>
    </Directory>

   </IfModule>
  </IfDefine>
 </IfDefine>
</IfDefine>
