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 7959 aaronmk
# remove www subdomain
14
RewriteCond %{HTTP_HOST} ^www\.(.*)$
15 8413 aaronmk
RewriteRule ^.*$ %{REQUEST_SCHEME}://%1%{REQUEST_URI} [discardpath,noescape,last]
16 7959 aaronmk
17 8178 aaronmk
# remove linewraps used to create a newline for Google spreadsheets
18
RewriteRule ^_-(.*)$ /$1 [discardpath,noescape,last,redirect]
19
20 8431 aaronmk
# set REQUEST_URI_NO_SLASH
21
RewriteCond %{REQUEST_URI} ^/$ [ornext]
22
RewriteCond %{REQUEST_URI} ^(.*)$
23
RewriteRule ^.*$ - [discardpath,env=REQUEST_URI_NO_SLASH:%1,noescape]
24
25 7987 aaronmk
# translate subdomain to path
26 8022 aaronmk
RewriteCond %{HTTP_HOST} !=vegbiendev.nceas.ucsb.edu
27
RewriteCond %{HTTP_HOST} ^(.*)\.([^.]*\.[^.]*)$
28 8432 aaronmk
RewriteRule ^.*$ %{REQUEST_SCHEME}://%2/${subdomain2path:%1}%{ENV:REQUEST_URI_NO_SLASH} [discardpath,noescape,last]
29 7987 aaronmk
30 8035 aaronmk
# use separate lowercase version when available
31
RewriteCond %{DOCUMENT_ROOT}/$1 !-d
32 8058 aaronmk
RewriteCond .${tolower:$1} ^.*$
33 8057 aaronmk
RewriteCond %{DOCUMENT_ROOT}/%0 -d
34 8390 aaronmk
RewriteRule ^([^/]*)(.*)$ %0$2 [discardpath,noescape,last]
35 8389 aaronmk
	# last: rewrite in the new subdir instead of applying this dir's rules
36 8035 aaronmk
37 8363 aaronmk
# parse dotpath in the query string
38
RewriteRule ^dotpath - [discardpath,noescape,last]
39
RewriteCond %{QUERY_STRING} ^(?!&).+$
40 8399 aaronmk
RewriteCond %{REQUEST_URI} ^(.*?)(?:/index(?:\.\w+)?)?$
41 8400 aaronmk
RewriteRule ^.*$ /dotpath%1 [discardpath,noescape,last]
42 7997 aaronmk
43 8363 aaronmk
# don't rewrite existing paths
44
RewriteCond %{REQUEST_FILENAME} -d [ornext]
45
RewriteCond %{REQUEST_FILENAME} -f
46
RewriteRule ^.*$ - [discardpath,noescape,last]
47 8041 aaronmk
48
## specific to /
49
50 8437 aaronmk
RewriteRule ^.+$ /VegCore/$0 [discardpath,noescape,last]