multiple domain to subfolder htaccess rewrite


RewriteEngine On
RewriteBase /

# —————————————
# BEGIN Domain to folder mapping

# pointing so9sad.com to folder_1
ReWriteCond %{HTTP_HOST} so9sad.com
ReWriteCond %{REQUEST_URI} !so9sad/
ReWriteRule ^(.*)$ so9sad/$1 [L]

# pointing youtube9loop.com to folder_2
ReWriteCond %{HTTP_HOST} youtube9loop.com
ReWriteCond %{REQUEST_URI} !youtube9loop/
ReWriteRule ^(.*)$ youtube9loop/$1 [L]

# END Domain to folder mapping
# —————————————

# —————————————
# BEGIN htaccess pretection


order allow,deny
deny from all

# END htaccess pretection
# —————————————

With wordpress:

RewriteEngine On
RewriteBase /

# —————————————
# BEGIN Domain to folder mapping

# pointing domain_1.com to folder_1
ReWriteCond %{HTTP_HOST} domain_1.com
ReWriteCond %{REQUEST_URI} !folder_1/
ReWriteRule ^(.*)$ folder_1/$1 [L]

# pointing domain_2.com to folder_2
ReWriteCond %{HTTP_HOST} domain_2.com
ReWriteCond %{REQUEST_URI} !folder_2/
ReWriteRule ^(.*)$ folder_2/$1 [L]

# END Domain to folder mapping
# —————————————

# —————————————
# BEGIN WordPress

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress
# —————————————

# —————————————
# BEGIN htaccess pretection


order allow,deny
deny from all

# END htaccess pretection
# —————————————

ref: http://wordpress.org/support/topic/success-mapping-multiple-domains-to-different-folders-with-htaccess