Created
June 20, 2016 11:59
-
-
Save SErr0r/1202540d8643401de91b747d1fe4a2a9 to your computer and use it in GitHub Desktop.
Mapping multiple domains to different folders with .htaccess
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: https://wordpress.org/support/topic/success-mapping-multiple-domains-to-different-folders-with-htaccess | |
<IfModule mod_rewrite.c> | |
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 | |
<Files .htaccess> | |
order allow,deny | |
deny from all | |
</Files> | |
# END htaccess pretection | |
# --------------------------------------- | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment