Project

General

Profile

1
#### URL resolution
2

    
3
Options +FollowSymLinks +Indexes +MultiViews
4

    
5
DirectorySlash off
6
DirectoryIndex index
7

    
8
### mod_rewrite
9

    
10
RewriteEngine on
11
RewriteOptions AllowNoSlash
12

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

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

    
20
# set REQUEST_URI_NO_SLASH
21
RewriteCond %{REQUEST_URI} ^/$ [ornext]
22
RewriteCond %{REQUEST_URI} ^(.*)$
23
RewriteRule ^ - [env=REQUEST_URI_no_/:%1]
24

    
25
# translate subdomain to path
26
RewriteCond %{HTTP_HOST} !=vegbiendev.nceas.ucsb.edu
27
RewriteCond %{HTTP_HOST} ^(.*)\.([^.]*\.[^.]*)$
28
RewriteRule ^.*$ %{REQUEST_SCHEME}://%2/${subdomain2path:%1}%{ENV:REQUEST_URI_no_/} [discardpath,noescape,last]
29

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

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

    
43
# don't rewrite existing paths
44
RewriteCond %{REQUEST_FILENAME} -d [ornext]
45
RewriteCond %{REQUEST_FILENAME} -f
46
RewriteRule ^ - [last]
47

    
48
## specific to /
49

    
50
RewriteRule ^.+$ /VegCore/$0 [discardpath,noescape,last]
(5-5/28)