File phpipam-http.conf of Package phpipam

Alias /phpipam "@APACHE_SERVERROOT@/phpipam"

<Directory "@APACHE_SERVERROOT@/phpipam">
    
    AllowOverride All
    Options FollowSymLinks
    
    <IfModule mod_authz_core.c>
      # Apache 2.4
      Require all granted
    </IfModule>
    <IfModule !mod_authz_core.c>
      # Apache 2.2
      Order allow,deny
      Allow from all
    </IfModule>
    
    
    <IfModule mod_rewrite.c>
      
      RewriteEngine on
      
      # change rewrite base if not in root
      RewriteBase /

      # passthroughs
      RewriteRule ^(api)($|/) - [L]
      RewriteRule ^index.php$ - [L]
      RewriteRule ^(css|js|site)/.*$ - [L]
      RewriteRule site/login/captcha/captchashow.php - [L]

      # redirect errors
      ErrorDocument 400 /error/400/
      ErrorDocument 401 /error/401/
      ErrorDocument 403 /error/403/
      ErrorDocument 404 /error/404/
      ErrorDocument 500 /error/500/

      # IE login dashboard fix
      RewriteRule ^login/dashboard/$ dashboard/ [R]
      RewriteRule ^logout/dashboard/$ dashboard/ [R]
      # search override
      RewriteRule ^tools/search/(.*)/(.*)/(.*)/(.*)$ index.php?page=tools&section=search&addresses=$1&subnets=$2&vlans=$3&ip=$4 [L]

      # Rewrites
      RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/$ index.php?page=$1&section=$2&subnetId=$3&sPage=$4&ipaddrid=$5 [L]
      RewriteRule ^(.*)/(.*)/(.*)/(.*)/$ index.php?page=$1&section=$2&subnetId=$3&sPage=$4 [L]
      RewriteRule ^(.*)/(.*)/(.*)/$ index.php?page=$1&section=$2&subnetId=$3 [L]
      RewriteRule ^(.*)/(.*)/$ index.php?page=$1&section=$2 [L]
      RewriteRule ^(.*)/$ index.php?page=$1 [L]

    </IfModule>
    
</Directory>

<Directory "@APACHE_SERVERROOT@/phpipam/db/bkp">
    <FilesMatch ".*">
       <IfModule mod_authz_core.c>
          # Apache 2.4
          Require all denied
       </IfModule>
       <IfModule !mod_authz_core.c>
          # Apache 2.2
          Order allow,deny
          Deny from all
       </IfModule>
    </FilesMatch>
</Directory>

<Directory "@APACHE_SERVERROOT@/phpipam/api">
    RewriteEngine On
    # exceptions
    RewriteRule ^(.*)/(.*)/cidr/(.*)/(.*)/$ ?app_id=$1&controller=$2&id=cidr&id2=$3&id3=$4 [L,QSA]
    RewriteRule ^(.*)/(.*)/cidr/(.*)/(.*) ?app_id=$1&controller=$2&id=cidr&id2=$3&id3=$4 [L,QSA]
    # controller rewrites
    RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/$ ?app_id=$1&controller=$2&id=$3&id2=$4&id3=$5 [L,QSA]
    RewriteRule ^(.*)/(.*)/(.*)/(.*)/$ ?app_id=$1&controller=$2&id=$3&id2=$4 [L,QSA]
    RewriteRule ^(.*)/(.*)/(.*)/$ ?app_id=$1&controller=$2&id=$3 [L,QSA]
    RewriteRule ^(.*)/(.*)/$ ?app_id=$1&controller=$2 [L,QSA]
    RewriteRule ^(.*)/$ ?app_id=$1 [L,QSA]
</Directory>

<Directory "@APACHE_SERVERROOT@/phpipam/api/v1">
    # redirect errors
    ErrorDocument 400 error/400/
    ErrorDocument 401 error/401/
    ErrorDocument 403 error/403/
    ErrorDocument 404 error/404/
    ErrorDocument 500 error/500/
</Directory>

<Directory "@APACHE_SERVERROOT@/phpipam/api/v2">
    RewriteEngine On
    # exceptions
    RewriteRule ^(.*)/(.*)/cidr/(.*)/(.*)/$ ?app_id=$1&controller=$2&id=cidr&id2=$3&id3=$4 [L,QSA]
    RewriteRule ^(.*)/(.*)/cidr/(.*)/(.*) ?app_id=$1&controller=$2&id=cidr&id2=$3&id3=$4 [L,QSA]
    # controller rewrites
    RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/$ ?app_id=$1&controller=$2&id=$3&id2=$4&id3=$5 [L,QSA]
    RewriteRule ^(.*)/(.*)/(.*)/(.*)/$ ?app_id=$1&controller=$2&id=$3&id2=$4 [L,QSA]
    RewriteRule ^(.*)/(.*)/(.*)/$ ?app_id=$1&controller=$2&id=$3 [L,QSA]
    RewriteRule ^(.*)/(.*)/$ ?app_id=$1&controller=$2 [L,QSA]
    RewriteRule ^(.*)/$ ?app_id=$1 [L,QSA]
</Directory>

<Directory "@APACHE_SERVERROOT@/phpipam/app/subnets/import-subnet/upload">
    # Don't list directory contents
    IndexIgnore *
    # Deny access via web to it
       <IfModule mod_authz_core.c>
          # Apache 2.4
          Require all denied
       </IfModule>
       <IfModule !mod_authz_core.c>
          # Apache 2.2
          Order allow,deny
          Deny from all
       </IfModule>
    # Disable script execution
    AddHandler cgi-script .php .php2 .php3 .php4 .php5 .php6 .php7 .php8 .pl .py .js .jsp .asp .htm .html .shtml .sh .cgi
    Options -ExecCGI -Indexes
</Directory>


<Directory "@APACHE_SERVERROOT@/phpipam/app/admin/import-export/upload">
    # Don't list directory contents
    IndexIgnore *
    # Deny access via web to it
       <IfModule mod_authz_core.c>
          # Apache 2.4
          Require all denied
       </IfModule>
       <IfModule !mod_authz_core.c>
          # Apache 2.2
          Order allow,deny
          Deny from all
       </IfModule>
    # Disable script execution
    AddHandler cgi-script .php .php2 .php3 .php4 .php5 .php6 .php7 .php8 .pl .py .js .jsp .asp .htm .html .shtml .sh .cgi
    Options -ExecCGI -Indexes
</Directory>


<Directory "@APACHE_SERVERROOT@/phpipam/app/login/captcha/audio">
    # Apache 2.4
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    # Apache 2.2
    <IfModule !mod_authz_core.c>
        Deny from all
    </IfModule>
</Directory>

<Directory "@APACHE_SERVERROOT@/phpipam/app/login/captcha/database">
    # Apache 2.4
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    # Apache 2.2
    <IfModule !mod_authz_core.c>
        Deny from all
    </IfModule>
</Directory>


<Directory "@APACHE_SERVERROOT@/phpipam/install">
    <IfModule mod_dir.c>
        DirectoryIndex disabled
    </IfModule>
</Directory>

<Directory "@APACHE_SERVERROOT@/phpipam/upgrade">
    <IfModule mod_dir.c>
        DirectoryIndex disabled
    </IfModule>
</Directory>

<Directory "@APACHE_SERVERROOT@/phpipam/css/1.3.1/images/logo">
    Options -ExecCGI -Indexes
    <FilesMatch "\.*$">
       <IfModule mod_authz_core.c>
          # Apache 2.4
          Require all denied
       </IfModule>
       <IfModule !mod_authz_core.c>
          # Apache 2.2
          Order allow,deny
          Deny from all
       </IfModule>
    </FilesMatch>
    <FilesMatch "\.(png)$">
       <IfModule mod_authz_core.c>
          # Apache 2.4
          Require all granted
       </IfModule>
       <IfModule !mod_authz_core.c>
          # Apache 2.2
          Order allow,deny
          Allow from all
       </IfModule>
    </FilesMatch>
</Directory>
openSUSE Build Service is sponsored by