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 8387 aaronmk
RewriteRule ^.*$ http://%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 7987 aaronmk
# translate subdomain to path
21 8022 aaronmk
RewriteCond %{HTTP_HOST} !=vegbiendev.nceas.ucsb.edu
22
RewriteCond %{HTTP_HOST} ^(.*)\.([^.]*\.[^.]*)$
23 8387 aaronmk
RewriteRule ^.*$ http://%2/${subdomain2path:%1}%{REQUEST_URI} [discardpath,noescape,last]
24 7987 aaronmk
25 8035 aaronmk
# use separate lowercase version when available
26
RewriteCond %{DOCUMENT_ROOT}/$1 !-d
27 8058 aaronmk
RewriteCond .${tolower:$1} ^.*$
28 8057 aaronmk
RewriteCond %{DOCUMENT_ROOT}/%0 -d
29 8390 aaronmk
RewriteRule ^([^/]*)(.*)$ %0$2 [discardpath,noescape,last]
30 8389 aaronmk
	# last: rewrite in the new subdir instead of applying this dir's rules
31 8035 aaronmk
32 8363 aaronmk
# parse dotpath in the query string
33
RewriteRule ^dotpath - [discardpath,noescape,last]
34
RewriteCond %{QUERY_STRING} ^(?!&).+$
35 8399 aaronmk
RewriteCond %{REQUEST_URI} ^(.*?)(?:/index(?:\.\w+)?)?$
36 8400 aaronmk
RewriteRule ^.*$ /dotpath%1 [discardpath,noescape,last]
37 7997 aaronmk
38 8363 aaronmk
# don't rewrite existing paths
39
RewriteCond %{REQUEST_FILENAME} -d [ornext]
40
RewriteCond %{REQUEST_FILENAME} -f
41
RewriteRule ^.*$ - [discardpath,noescape,last]
42 8041 aaronmk
43
## specific to /
44
45 8404 aaronmk
RewriteRule ^.+$ https://projects.nceas.ucsb.edu/nceas/projects/bien/wiki/VegCore#$0 [discardpath,noescape,last]