Forum Moderators: phranque
custom.startingdomain.com. IN CNAME www.contentdomain.com. <VirtualHost XX.XX.XX.XX:80>
ServerName contentdomain.com:80
ServerAlias www.contentdomain.com
ServerAlias custom.startingdomain.com
DocumentRoot /var/www/vhosts/contentdomain.com/httpdocs
</VirtualHost> foobar.startingdomain.com. IN CNAME www.contentdomain.com. http://www\.contentdomain\.com%{REQUEST_URI} [R=301,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?contentdomain\.com$ [NC]
RewriteCond %{HTTP_HOST} !^custom\.startingdomain\.com$ [NC]
RewriteRule .? - [F]
RewriteEngine On
Options +FollowSymlinks
Options +SymlinksIfOwnerMatch
# ===============================================
# =============================================== BAN UNKNOWN DOMAINS
RewriteCond %{HTTP_HOST} !^(www\.)?contentdomain\.com$ [NC]
RewriteCond %{HTTP_HOST} !^custom\.startingdomain\.com$ [NC]
RewriteRule .? - [F,L]
# ===============================================
# =============================================== REWRITE ENGINE FORWARDING
RewriteCond %{HTTP_HOST} ^([A-Z0-9\-]+)\.([A-Z0-9\-]+)\.([A-Z0-9._%-]+@[A-Z0-9.-]+\.(?:[A-Z]{2}|com|org|net|gov|biz|mil|edu|coop|info|name|aero|jobs|museum|mobi))$ [NC]
RewriteRule ^$ http://%1.%2.%3/do-something.php?id=%1%2%3 [L]
RewriteEngine On
Options +FollowSymlinks
#
# Block requests for unknown hostnames
RewriteCond %{HTTP_HOST} !^(www\.)?contentdomain\.com$ [NC]
RewriteCond %{HTTP_HOST} !^custom\.startingdomain\.com$ [NC]
RewriteRule .? - [F]