Project

General

Profile

« Previous | Next » 

Revision 7968

web/vegpath/.htaccess: translate subdomain to prefix: Don't translate all nested subdomains, because some of them may result from the machine's own name (vegbiendev.nceas.ucsb.edu) and should not be removed. Instead, remove only the leftmost level of subdomain, and only if it corresponds to a filesystem directory.

View differences:

.htaccess
6 6
### mod_rewrite
7 7

  
8 8
RewriteEngine on
9
RewriteOptions inherit
10 9
RewriteBase /
11 10

  
12 11
# remove www subdomain
13 12
RewriteCond %{HTTP_HOST} ^www\.(.*)$
14 13
RewriteRule ^.*$ http://%1/$0 [redirect]
15 14

  
16
# translate subdomain to path prefix
17
RewriteCond %{HTTP_HOST} ^(.+)\.([^.]*\.[^.]*)$
18
RewriteRule ^.*$ http://%2/%1.$0 [redirect]
15
# translate subdomain to prefix
16
RewriteCond %{HTTP_HOST} ^([^.]*)\.(.*)$
17
RewriteCond %1 -d [ornext]
18
RewriteCond %1 -l
19
RewriteRule ^.*$ %1/$0
19 20

  
20 21
# don't rewrite existing paths
21 22
RewriteCond %{REQUEST_FILENAME} -d [ornext]

Also available in: Unified diff