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
# translate subdomain to path
21
RewriteCond %{HTTP_HOST} !=vegbiendev.nceas.ucsb.edu
22
RewriteCond %{HTTP_HOST} ^(.*)\.([^.]*\.[^.]*)$
23
RewriteRule ^.*$ %{REQUEST_SCHEME}://%2/${subdomain2path:%1}%{REQUEST_URI} [discardpath,noescape,last]
24

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

    
32
# parse dotpath in the query string
33
RewriteRule ^dotpath - [discardpath,noescape,last]
34
RewriteCond %{QUERY_STRING} ^(?!&).+$
35
RewriteCond %{REQUEST_URI} ^(.*?)(?:/index(?:\.\w+)?)?$
36
RewriteRule ^.*$ /dotpath%1 [discardpath,noescape,last]
37

    
38
# don't rewrite existing paths
39
RewriteCond %{REQUEST_FILENAME} -d [ornext]
40
RewriteCond %{REQUEST_FILENAME} -f
41
RewriteRule ^.*$ - [discardpath,noescape,last]
42

    
43
## specific to /
44

    
45
RewriteRule ^.+$ https://projects.nceas.ucsb.edu/nceas/projects/bien/wiki/VegCore#$0 [discardpath,noescape,last]
(4-4/23)