Project

General

Profile

« Previous | Next » 

Revision 8450

web/**/.htaccess: Use [qsappend] flag with all RewriteRules to ensure that the original query string is never lost

View differences:

.htaccess
14 14

  
15 15
# remove www subdomain
16 16
RewriteCond %{HTTP_HOST} ^www\.(.*)$
17
RewriteRule ^.*$ %{REQUEST_SCHEME}://%1%{REQUEST_URI} [discardpath,noescape,last]
17
RewriteRule ^.*$ %{REQUEST_SCHEME}://%1%{REQUEST_URI} [discardpath,noescape,last,qsappend]
18 18

  
19 19
# remove linewraps used to create a newline for Google spreadsheets
20
RewriteRule ^_-(.*)$ /$1 [discardpath,noescape,last,redirect]
20
RewriteRule ^_-(.*)$ /$1 [discardpath,noescape,last,redirect,qsappend]
21 21

  
22 22
# set REQUEST_URI_NO_SLASH
23 23
RewriteCond %{REQUEST_URI} ^/$ [ornext]
......
27 27
# translate subdomain to path
28 28
RewriteCond %{HTTP_HOST} !=vegbiendev.nceas.ucsb.edu
29 29
RewriteCond %{HTTP_HOST} ^(.*)\.([^.]*\.[^.]*)$
30
RewriteRule ^.*$ %{REQUEST_SCHEME}://%2/${subdomain2path:%1}%{ENV:REQUEST_URI_no_/} [discardpath,noescape,last]
30
RewriteRule ^.*$ %{REQUEST_SCHEME}://%2/${subdomain2path:%1}%{ENV:REQUEST_URI_no_/} [discardpath,noescape,last,qsappend]
31 31

  
32 32
# use separate lowercase version when available
33 33
RewriteCond %{ENV:innermost_dir} =/
34 34
RewriteCond %{DOCUMENT_ROOT}/$1 !-d
35 35
RewriteCond .${tolower:$1} ^.*$
36 36
RewriteCond %{DOCUMENT_ROOT}/%0 -d
37
RewriteRule ^([^/]*)(.*)$ %0$2 [discardpath,noescape,last]
37
RewriteRule ^([^/]*)(.*)$ %0$2 [discardpath,noescape,last,qsappend]
38 38
	# last: rewrite in the new subdir instead of applying this dir's rules
39 39

  
40 40
# parse dotpath in the query string
41
RewriteRule ^dotpath - [discardpath,noescape,last]
41
RewriteRule ^dotpath - [discardpath,noescape,last,qsappend]
42 42
RewriteCond %{QUERY_STRING} ^(?!&).+$
43 43
RewriteCond %{REQUEST_URI} ^(.*?)(?:/index(?:\.\w+)?)?$
44
RewriteRule ^.*$ /dotpath%1 [discardpath,noescape,last]
44
RewriteRule ^.*$ /dotpath%1 [discardpath,noescape,last,qsappend]
45 45

  
46 46
# don't rewrite existing paths
47 47
RewriteCond %{REQUEST_FILENAME} -d [ornext]
48 48
RewriteCond %{REQUEST_FILENAME} -f
49
RewriteRule ^(?!/).+$ - [discardpath,noescape,last]
49
RewriteRule ^(?!/).+$ - [discardpath,noescape,last,qsappend]
50 50

  
51 51
# handle DirectoryIndex subrequests when there is no DirectoryIndex
52 52
# use -F subrequest so that MultiViews auto-appends any extension
53 53
RewriteCond %{REQUEST_FILENAME} !-F
54
RewriteRule ^(.*/)?index$ $1 [discardpath,noescape]
54
RewriteRule ^(.*/)?index$ $1 [discardpath,noescape,qsappend]
55 55

  
56 56
## specific to /
57 57

  
58 58
RewriteCond %{ENV:innermost_dir} =/
59
RewriteRule ^.+$ /VegCore/$0 [discardpath,noescape,last]
59
RewriteRule ^.+$ /VegCore/$0 [discardpath,noescape,last,qsappend]

Also available in: Unified diff