Forum Moderators: phranque
RewriteEngine on
Options +FollowSymlinks
RewriteCond %{HTTP_HOST} domain2.com$ [NC]
RewriteCond %{REQUEST_URI} !^/vhosts/sub/.*$
RewriteRule ^(.*)$ /vhosts/sub/$1 [L] RewriteRule ^ http://www.google.com [R=301,L]
RewriteEngine on
Options +FollowSymlinks
#
# Internally rewrite requests for URL <anything or nothing>.domain2.com/<URL-path>
# to filepath /sub/<URL-path>
RewriteCond %{HTTP_HOST} ^([^.]+\.)*domain2\.com$ [NC]
RewriteCond $1 !^sub/
RewriteRule ^(.*)$ /sub/$1 [L]
RewriteEngine on
Options +FollowSymlinks
#
# Internally rewrite requests for URL http://<anything or nothing>.<domain-name>/<URL-path>
# to filepath /domains/<domain-name>/<URL-path>
RewriteCond $1 !^domains/
RewriteCond %{HTTP_HOST} ^([^.]+\.)*([a-z[0-9]\-]+\.[a-z]{3,6})$
RewriteRule ^(.*)$ /domains/%2/$1 [L]