summaryrefslogtreecommitdiffstats
path: root/server/etc/apache-console3.conf.tmpl
blob: e4c4f8d6f5f94567fd33720d7478ea4b30fe9a99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# OpenGnsys Web Admin Console 3 template configuration for Apache.

Alias /opengnsys/v3 CONSOLEDIR3

RewriteEngine On

# Redirect HTTP to HTTPS and default configuration.
<Directory CONSOLEDIR>
        RewriteCond %{HTTPS} !=on
        RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
        Require all granted
        Options -Indexes +FollowSymLinks
        DirectoryIndex index.html index.php
        AddType octet/stream .pkg
</Directory>

# Redirect HTTP to HTTPS and RESTful configuration.
<Directory CONSOLEDIR3/backend/web>
        #RewriteBase /opengnsys3/rest/web
        #RewriteRule .? - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
        #RewriteCond %{HTTPS} !=on
        #RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
        #RewriteCond %{REQUEST_FILENAME} !-f
        #RewriteRule ^ index.php [QSA,L]
        DirectoryIndex app.php

        <IfModule mod_rewrite.c>
                RewriteEngine On
                RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
                RewriteRule ^(.*) - [E=BASE:%1]

                # Sets the HTTP_AUTHORIZATION header removed by apache
                RewriteCond %{HTTP:Authorization} .
                RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

                RewriteCond %{ENV:REDIRECT_STATUS} ^$
                RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]

                RewriteCond %{REQUEST_FILENAME} -f
                RewriteRule .? - [L]

                # Rewrite all other queries to the front controller.
                RewriteRule .? %{ENV:BASE}/app.php [L]
        </IfModule>

        <IfModule !mod_rewrite.c>
                <IfModule mod_alias.c>
                        RedirectMatch 302 ^/$ /app.php/
                </IfModule>
        </IfModule>
</Directory>