1 |
8038
|
aaronmk
|
RewriteEngine on
|
2 |
8446
|
aaronmk
|
RewriteOptions AllowNoSlash InheritBefore
|
3 |
8038
|
aaronmk
|
|
4 |
8444
|
aaronmk
|
SetEnvIf Request_URI ^ innermost_dir=phpPgAdmin
|
5 |
|
|
|
6 |
12175
|
aaronmk
|
# remove trailing / (not used)
|
7 |
|
|
RewriteRule ^(.*)/$ $1 [discardpath,noescape,qsappend]
|
8 |
8485
|
aaronmk
|
|
9 |
12175
|
aaronmk
|
# extract base URL
|
10 |
|
|
RewriteRule ^\[(.*)\](?:/(.*))?$ $2 [discardpath,noescape,qsappend,env=base_url:http://$1]
|
11 |
|
|
|
12 |
|
|
# extract path components 1st->last
|
13 |
13114
|
aaronmk
|
#
|
14 |
|
|
# phpPgAdmin bug causes page to be ignored when not logged in. this is partially
|
15 |
|
|
# fixed by also specifying subject, which is not ignored. (however, when it
|
16 |
|
|
# falls back to using subject, it will go to the last selected tab, not the
|
17 |
|
|
# default, leftmost tab.)
|
18 |
|
|
#
|
19 |
|
|
# subject values @ /usr/share/phppgadmin/classes/Misc.php#getSubjectParams()
|
20 |
13652
|
aaronmk
|
RewriteRule ^ - [discardpath,noescape,qsappend,env=subject:root,env=page:servers]
|
21 |
|
|
RewriteRule ^([^/]+)(?:/(.*))?$ $2?server=$1 [discardpath,noescape,qsappend,env=subject:server,env=page:all_db]
|
22 |
|
|
RewriteRule ^([^/]+)(?:/(.*))?$ $2?database=$1 [discardpath,noescape,qsappend,env=subject:database,env=page:schemas]
|
23 |
13831
|
aaronmk
|
RewriteRule ^([^/]+)(?:/(.*))?$ $2?schema=$1 [discardpath,noescape,qsappend,env=subject:schema,env=page:tables,chain]
|
24 |
13830
|
aaronmk
|
RewriteRule ^:(.*)()$ $2 [discardpath,noescape,qsappend,env=page:$1]
|
25 |
13831
|
aaronmk
|
RewriteRule ^view=([^/]+)(?:/(.*))?$ $2?view=$1 [discardpath,noescape,qsappend,env=subject:view,env=page:viewproperties,env=action:columns,chain]
|
26 |
13828
|
aaronmk
|
RewriteRule ^:(.*)()$ $2 [discardpath,noescape,qsappend,env=action:$1]
|
27 |
13652
|
aaronmk
|
RewriteRule ^fn.oid=([^/]+)(?:/(.*))?$ $2?function_oid=$1 [discardpath,noescape,qsappend,env=subject:function,env=page:functions,env=action:properties]
|
28 |
13831
|
aaronmk
|
RewriteRule ^([^/]+)(?:/(.*))?$ $2?table=$1 [discardpath,noescape,qsappend,env=subject:table,env=page:tblproperties,chain]
|
29 |
13829
|
aaronmk
|
RewriteRule ^:(.*)()$ $2 [discardpath,noescape,qsappend,env=page:$1]
|
30 |
13652
|
aaronmk
|
RewriteRule ^([^/]+)(?:/(.*))?$ $2?column=$1 [discardpath,noescape,qsappend,env=subject:column,env=page:colproperties]
|
31 |
12175
|
aaronmk
|
|
32 |
13459
|
aaronmk
|
# custom pages
|
33 |
|
|
# must be in query string b/c .php filename would be treated as path element
|
34 |
|
|
RewriteCond %{QUERY_STRING} ^(?:.*&)?page=([^&]*)
|
35 |
|
|
RewriteRule ^ - [discardpath,noescape,qsappend,env=!subject,env=page:%1]
|
36 |
|
|
|
37 |
12175
|
aaronmk
|
# redirect to now-constructed URL
|
38 |
13460
|
aaronmk
|
# only append subject if non-empty, to avoid confusing redirect.php
|
39 |
12175
|
aaronmk
|
RewriteCond %{ENV:base_url} !=""
|
40 |
13460
|
aaronmk
|
RewriteCond %{ENV:subject} ="" [ornext]
|
41 |
|
|
RewriteCond ?subject=%{ENV:subject} ^(.*)$
|
42 |
13651
|
aaronmk
|
RewriteRule ^$ %{ENV:base_url}/%{ENV:page}.php%1 [chain,discardpath,noescape,qsappend,redirect]
|
43 |
|
|
# append action
|
44 |
|
|
RewriteCond %{ENV:action} ="" [ornext]
|
45 |
13661
|
aaronmk
|
RewriteCond ?action=%{ENV:action} ^(.*)$
|
46 |
|
|
RewriteRule ^.*$ $0%1 [discardpath,noescape,qsappend,redirect]
|
47 |
12175
|
aaronmk
|
|
48 |
|
|
## for internal URLs
|
49 |
|
|
|
50 |
8485
|
aaronmk
|
# auto-add trailing / (dir without trailing / is absolute filesystem path)
|
51 |
|
|
RewriteCond %{ENV:innermost_dir} =phpPgAdmin
|
52 |
8507
|
aaronmk
|
RewriteRule ^/ %{REQUEST_URI}/ [discardpath,last,noescape,qsappend,redirect]
|