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
RewriteRule ^                   -              [discardpath,noescape,qsappend,env=page:servers]
14
RewriteRule ^([^/]+)(?:/(.*))?$ $2?server=$1   [discardpath,noescape,qsappend,env=page:all_db]
15
RewriteRule ^([^/]+)(?:/(.*))?$ $2?database=$1 [discardpath,noescape,qsappend,env=page:schemas]
16
RewriteRule ^([^/]+)(?:/(.*))?$ $2?schema=$1   [discardpath,noescape,qsappend,env=page:tables]
17
RewriteRule ^([^/]+)(?:/(.*))?$ $2?table=$1    [discardpath,noescape,qsappend,env=page:tblproperties]
18
RewriteRule ^([^/]+)(?:/(.*))?$ $2?column=$1   [discardpath,noescape,qsappend,env=page:colproperties]
19

    
20
# redirect to now-constructed URL
21
RewriteCond %{ENV:base_url} !=""
22
RewriteRule ^$ %{ENV:base_url}/%{ENV:page}.php [discardpath,last,noescape,qsappend,redirect]
23

    
24
## for internal URLs
25

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