Project

General

Profile

« Previous | Next » 

Revision 8022

web/main/.htaccess: translate subdomain to path: Don't use expr RewriteConds because they are not supported by Apache 2.2. Instead issue an external redirect with the subdomain part of the hostname removed, for the purpose of changing HTTP_HOST so that the replacement is not performed again if the mod_rewrite rules are run more than once.

View differences:

web/main/.htaccess
13 13
RewriteRule ^.*$ http://%1/$0 [discardpath,noescape,last]
14 14

  
15 15
# translate subdomain to path
16
RewriteCond expr "%{HTTP_HOST} != %{SERVER_NAME}"
17
RewriteCond %{HTTP_HOST} ^(.*)(\.[^.]*){2}$
18
RewriteCond ${subdomain2path:%1} ^([^/]*).*$
19
RewriteCond expr "! $0 -fnmatch '%1*'"
20
RewriteRule ^.*$ %0/$0 [discardpath,noescape]
16
RewriteCond %{HTTP_HOST} !=vegbiendev.nceas.ucsb.edu
17
RewriteCond %{HTTP_HOST} ^(.*)\.([^.]*\.[^.]*)$
18
RewriteRule ^.*$ http://%2/${subdomain2path:%1}/$0 [discardpath,noescape,last]
21 19

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

Also available in: Unified diff