Forum Moderators: phranque
/.htaccess
/index.php
/sub-site-one/index.php
/sub-site-one/.htaccess
/sub-site-two/index.php
/sub-site-two/.htaccess
RewriteEngine On
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
# -- NSM .htaccess Generator Start --
# .htaccess generated by NSM .htaccess Generator v1.0.3
# @see: http://expressionengine-addons.com/nsm-htaccess-generator
# secure .htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>
# EE 404 page for missing pages
ErrorDocument 404 /index.php/
# Simple 404 for missing files
<FilesMatch "(\.jpe?g|gif|png|bmp|css|js|flv)$">
ErrorDocument 404 "File Not Found"
</FilesMatch>
# Although highly unlikely, your host may have +FollowSymLinks enabled at the root level, yet disallow its addition in .htaccess; in which case, adding +FollowSymLinks will break your setup (probably a 500 error), so just remove it, and your rules should work fine.
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
# Remove index.php
# Uses the "include method"
# http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method
RewriteCond %{QUERY_STRING} !^(ACT=.*)$ [NC]
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5})$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/(home_page|site_wide|single_pages|galleries|people|news|board|overlays|property-development|development-management|hotel-and-hospitality|funds-management|news|about|members|P[0-9]{2,8}) [NC]
RewriteRule (.*) /index.php/$1 [L]
# -- NSM .htaccess Generator End --
# Capture the subdomain from the REMOTE_HOST
RewriteCond %{REMOTE_HOST} ^(.*)\.example\.com$ [NC]
# Make sure the path doesn't already start with the subdomain + /
RewriteCond %{REQUEST_URI} !^%1/
# Internally rewrite whatever is in the path ($1) to the subdirectory (%1)
RewriteRule (.*) /%1/$1 [L]
Are there really separate domains, or is sub-site a sub-domain of main-domain.
If the sub-site is "foo" is it "www.foo.com" or "foo.main-domain.com"?
# Capture the domain from the REMOTE_HOST. You probably want the
# second part after an optional www up to the next . (handling .com,
# .co.uk, .biz, etc.)
RewriteCond %{REMOTE_HOST} ^(www\.)?(.*)\. [NC]
# Make sure the path doesn't already start with the domain + . some
# characters, then a /
RewriteCond %{REQUEST_URI} !^%1\.*/
# Internally rewrite whatever is in the path ($1) to the subdirectory (%1)
RewriteRule (.*) /%1/$1 [L]
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.domain-one.com
ServerAlias domain-one.com
DocumentRoot /usr/local/www/vhosts/domain-one.com/httpdocs/
</VirtualHost>
<VirtualHost *:80>
ServerName www.domain-two.com
ServerAlias domain-two.com
DocumentRoot /usr/local/www/vhosts/domain-one.com/httpdocs/domain-two/
</VirtualHost>