Project

General

Profile

1
RewriteEngine on
2
RewriteOptions AllowNoSlash
3

    
4
SetEnvIf Request_URI ^ innermost_dir=TNRS
5

    
6
# parse dotpath in the query string
7
RewriteCond %{QUERY_STRING} ^(?!&).+$
8
RewriteCond %{REQUEST_URI} ^(.*?)(?:/index(?:\.\w+)?)?$
9
RewriteRule ^.*$ /dotpath%1 [discardpath,noescape,last]
10

    
11
# don't rewrite existing paths
12
RewriteCond %{REQUEST_FILENAME} -d [ornext]
13
RewriteCond %{REQUEST_FILENAME} -f
14
RewriteRule ^(?!/).+$ - [discardpath,noescape,last]
15

    
16
# handle DirectoryIndex subrequests
17
RewriteRule ^index$() $1 [discardpath,noescape]
18

    
19
# dir without trailing / is provided as an absolute filesystem path
20
RewriteCond %{ENV:innermost_dir} =TNRS
21
RewriteCond $0 ^/ [ornext]
22
RewriteCond ?&$0 ^(.*)$
23
RewriteRule ^.+$ http://tnrs.iplantcollaborative.org/instructions.html%1#download_results [discardpath,noescape,last]
(1-1/4)