Forum Moderators: phranque
# If NOT any valid port/hostname combination, deny access
RewriteCond %{SERVER_PORT}>%{HTTP_HOST} !^11010>uat1\.example\.com
RewriteCond %{SERVER_PORT}>%{HTTP_HOST} !^11020>uat2\.example\.com
RewriteCond %{SERVER_PORT}>%{HTTP_HOST} !^11030>uat3\.example\.com
RewriteRule ^ - [F]
RewriteCond %{SERVER_PORT}>%{HTTP_HOST} !^10025>uat2\.(3dns\.)?example\.com
RewriteRule !^/error/HTTP_FORBIDDEN\.html$ - [F]
<VirtualHost 0.0.0.0:10025>
Options +FollowSymLinks -MultiViews
AcceptPathInfo off
RewriteEngine on
RewriteLog /tmp/rewrite.log
RewriteLogLevel 3
# If incorrect hostname for this port, return 403 unless the 403 errordocument itself is being requested
RewriteCond %{HTTP_HOST} !^uat2\.(3dns\.)?example\.com [NC]
RewriteRule !^/error/HTTP_FORBIDDEN\.html$ - [F]