Project

General

Profile

1 7876 aaronmk
#### URL resolution
2
3 8397 aaronmk
Options +FollowSymLinks +Indexes +MultiViews
4 8055 aaronmk
5 8402 aaronmk
DirectorySlash off
6 8396 aaronmk
DirectoryIndex index
7 7876 aaronmk
8
### mod_rewrite
9
10 7878 aaronmk
RewriteEngine on
11 8405 aaronmk
RewriteOptions AllowNoSlash
12 7876 aaronmk
13 8443 aaronmk
SetEnvIf Request_URI ^ innermost_dir=/
14
15 7959 aaronmk
# remove www subdomain
16
RewriteCond %{HTTP_HOST} ^www\.(.*)$
17 8413 aaronmk
RewriteRule ^.*$ %{REQUEST_SCHEME}://%1%{REQUEST_URI} [discardpath,noescape,last]
18 7959 aaronmk
19 8178 aaronmk
# remove linewraps used to create a newline for Google spreadsheets
20
RewriteRule ^_-(.*)$ /$1 [discardpath,noescape,last,redirect]
21
22 8431 aaronmk
# set REQUEST_URI_NO_SLASH
23
RewriteCond %{REQUEST_URI} ^/$ [ornext]
24
RewriteCond %{REQUEST_URI} ^(.*)$
25 8441 aaronmk
RewriteRule ^ - [env=REQUEST_URI_no_/:%1]
26 8431 aaronmk
27 7987 aaronmk
# translate subdomain to path
28 8022 aaronmk
RewriteCond %{HTTP_HOST} !=vegbiendev.nceas.ucsb.edu
29
RewriteCond %{HTTP_HOST} ^(.*)\.([^.]*\.[^.]*)$
30 8439 aaronmk
RewriteRule ^.*$ %{REQUEST_SCHEME}://%2/${subdomain2path:%1}%{ENV:REQUEST_URI_no_/} [discardpath,noescape,last]
31 7987 aaronmk
32 8035 aaronmk
# use separate lowercase version when available
33 8443 aaronmk
RewriteCond %{ENV:innermost_dir} =/
34 8035 aaronmk
RewriteCond %{DOCUMENT_ROOT}/$1 !-d
35 8058 aaronmk
RewriteCond .${tolower:$1} ^.*$
36 8057 aaronmk
RewriteCond %{DOCUMENT_ROOT}/%0 -d
37 8390 aaronmk
RewriteRule ^([^/]*)(.*)$ %0$2 [discardpath,noescape,last]
38 8389 aaronmk
	# last: rewrite in the new subdir instead of applying this dir's rules
39 8035 aaronmk
40 8363 aaronmk
# parse dotpath in the query string
41
RewriteRule ^dotpath - [discardpath,noescape,last]
42
RewriteCond %{QUERY_STRING} ^(?!&).+$
43 8399 aaronmk
RewriteCond %{REQUEST_URI} ^(.*?)(?:/index(?:\.\w+)?)?$
44 8400 aaronmk
RewriteRule ^.*$ /dotpath%1 [discardpath,noescape,last]
45 7997 aaronmk
46 8363 aaronmk
# don't rewrite existing paths
47
RewriteCond %{REQUEST_FILENAME} -d [ornext]
48
RewriteCond %{REQUEST_FILENAME} -f
49 8442 aaronmk
RewriteRule ^(?!/).+$ - [discardpath,noescape,last]
50 8041 aaronmk
51
## specific to /
52
53 8443 aaronmk
RewriteCond %{ENV:innermost_dir} =/
54 8437 aaronmk
RewriteRule ^.+$ /VegCore/$0 [discardpath,noescape,last]