Last active
August 29, 2015 14:06
-
-
Save timkinnane/2b6ad0be9ab20579ad14 to your computer and use it in GitHub Desktop.
htaccess for two Wordpress installs in side by side subfolders, one resolving to primary domain, one to subdomain.
This file contains 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
## Example DOMAIN.TLD serves MAIN folder | |
## SUB folder served from SUB.DOMAIN.TLD | |
## --- public_html/ .htaccess --- ## | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^(www.)?DOMAIN.TLD/$ | |
RewriteRule ^$ /MAIN/ [L] | |
# Remove WWW (optional) | |
RewriteCond %{HTTP_HOST} ^www.DOMAIN.TLD$ [NC] | |
RewriteRule ^(.*)$ http://DOMAIN.TLD/$1 [L] | |
# Redirect to folder | |
RewriteCond %{HTTP_HOST} ^(www.)?DOMAIN.TLD$ | |
RewriteCond %{REQUEST_URI} !^/MAIN/ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ /MAIN/$1 | |
## --- MAIN folder .htaccess --- ## | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase /MAIN/ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /MAIN/index.php [L] | |
</IfModule> | |
## --- SUB folder .htaccess = WP default --- ## | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.php [L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment