Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (39 sloc) 2.25 KB
# (c) 2018 Apis Networks
# Domain rewrite maps
SetEnvIfNoCase Host ^(?:www\.)?+([^:]+) DOMAIN=$1
RewriteEngine Off
<IfDefine !BYPASS_HTTP10>
# Spam bots
RewriteMap HTTP10_MAP "dbm:conf/http10"
RewriteCond %{SERVER_PROTOCOL} =HTTP/1.0
RewriteCond %{HTTP_USER_AGENT} !^Jetpack
RewriteCond %{HTTP_USER_AGENT} !^PayPal\sIPN
RewriteCond ${HTTP10_MAP:%{ENV:DOMAIN}|NOT-FOUND} =NOT-FOUND
RewriteRule ^ - [L,R=400]
</IfDefine>
RewriteRule ^/cpadmin https://%{ENV:HOSTNAME}:2083/login?domain=%{HTTP_HOST} [L]
RewriteRule ^/.well-known/(.*)$ /tmp/acme/.well-known/$1 [L]
# Thunderbird
RewriteRule ^/.well-known/autoconfig/(mail/.*) /var/www/html/autodiscover.php [QSA,L]
# Outlook
RewriteRule ^/[Aa]utodiscover/[Aa]utodiscover\.xml /var/www/html/autodiscover.php [QSA,L]
# Addon domain lookup
RewriteCond ${DOMAIN_MAP:%{ENV:DOMAIN}} ^(/.*)$
RewriteRule ^ - [S=1,E=VHOST:%{ENV:DOMAIN},E=VPATH:%1,E=L-%{ENV:DOMAIN}:1]
# No match, primary domain. Skip to subdomains
RewriteRule ^ - [S=1,E=VPATH:%{DOCUMENT_ROOT}]
RewriteRule ^(.*)$ %{ENV:VPATH}$1 [L]
RewriteCond %{ENV:DOMAIN} ^([^.]++)\.([^.]{3,}+\..++)$
RewriteRule ^ - [E=__S1:%2,E=__S2:%1,S=1]
RewriteRule ^ - [L,E=L-%{ENV:DOMAIN}:1]
# DOCUMENT_ROOT is inadequate. It will be overwritten before finalizing the request
RewriteCond /home/virtual/site%{ENV:SITE_ID}/fst/var/subdomain/%{ENV:DOMAIN}/html -d
RewriteRule ^/(.*)$ /home/virtual/site%{ENV:SITE_ID}/fst/var/subdomain/%{ENV:DOMAIN}/html/$1 [L,E=L-%{ENV:DOMAIN}:1,E=VPATH:/home/virtual/site%{ENV:SITE_ID}/fst/var/subdomain/%{ENV:DOMAIN}/html]
RewriteCond /home/virtual/site%{ENV:SITE_ID}/fst/var/subdomain/%{ENV:__S1}/html -d
RewriteRule ^/(.*)$ /home/virtual/site%{ENV:SITE_ID}/fst/var/subdomain/%{ENV:__S1}/html/$1 [L,E=L-%{ENV:__S1}:1,E=VPATH:/home/virtual/site%{ENV:SITE_ID}/fst/var/subdomain/%{ENV:__S1}/html]
RewriteCond /home/virtual/site%{ENV:SITE_ID}/fst/var/subdomain/%{ENV:__S2}/html -d
RewriteRule ^/(.*)$ /home/virtual/site%{ENV:SITE_ID}/fst/var/subdomain/%{ENV:__S2}/html/$1 [L,E=L-_%{ENV:__S2}:1,E=VPATH:/home/virtual/site%{ENV:SITE_ID}/fst/var/subdomain/%{ENV:__S2}/html]
RewriteCond %{ENV:__S2} ^mail|^horde|^roundcube
RewriteRule ^(.*)$ /var/www/html/%{ENV:__S2}/$1 [L]
# Fallthrough to primary domain. Requires DNS record on bogus subdomain to work
RewriteRule ^ - [E=L-%{ENV:__S1}:1]
You can’t perform that action at this time.