Project

General

Profile

1
RewriteEngine on
2
RewriteOptions AllowNoSlash InheritBefore
3

    
4
SetEnvIf Request_URI ^ innermost_dir=phpPgAdmin
5

    
6
# remove trailing / (not used)
7
RewriteRule ^(.*)/$ $1 [discardpath,noescape,qsappend]
8

    
9
# extract base URL
10
RewriteRule ^\[(.*)\](?:/(.*))?$ $2 [discardpath,noescape,qsappend,env=base_url:http://$1]
11

    
12
# extract path components 1st->last
13
# can't use subject param because that goes to the last selected tab, not the
14
# default (leftmost) tab
15
RewriteRule ^                          -                                    [discardpath,noescape,qsappend,env=page:servers]
16
RewriteRule ^([^/]+)(?:/(.*))?$        $2?server=$1                         [discardpath,noescape,qsappend,env=page:all_db]
17
RewriteRule ^([^/]+)(?:/(.*))?$        $2?database=$1                       [discardpath,noescape,qsappend,env=page:schemas]
18
RewriteRule ^([^/]+)(?:/(.*))?$        $2?schema=$1                         [discardpath,noescape,qsappend,env=page:tables]
19
RewriteRule ^(views|functions)()$      $2                                   [discardpath,noescape,qsappend,env=page:$1]
20
RewriteRule ^view=([^/]+)(?:/(.*))?$   $2?view=$1&action=definition         [discardpath,noescape,qsappend,skip=2,env=page:viewproperties]
21
RewriteRule ^fn.oid=([^/]+)(?:/(.*))?$ $2?function_oid=$1&action=properties [discardpath,noescape,qsappend,skip=1,env=page:functions]
22
RewriteRule ^([^/]+)(?:/(.*))?$        $2?table=$1                          [discardpath,noescape,qsappend,env=page:tblproperties]
23
RewriteRule ^([^/]+)(?:/(.*))?$        $2?column=$1                         [discardpath,noescape,qsappend,env=page:colproperties]
24

    
25
# redirect to now-constructed URL
26
RewriteCond %{ENV:base_url} !=""
27
RewriteRule ^$ %{ENV:base_url}/%{ENV:page}.php [discardpath,last,noescape,qsappend,redirect]
28

    
29
## for internal URLs
30

    
31
# auto-add trailing / (dir without trailing / is absolute filesystem path)
32
RewriteCond %{ENV:innermost_dir} =phpPgAdmin
33
RewriteRule ^/ %{REQUEST_URI}/ [discardpath,last,noescape,qsappend,redirect]
    (1-1/1)