Friday, June 21, 2013

Serve Pages from Subfolder on Apache

Multiple site hosting on one hosting account in subfolders

Directory structure for domains example.com and otherexample.com

[Folder] public_html
[File  ]    .htaccess
[Folder]    example.com
[File  ]         index.php
[Folder]    otherexample.com
[File  ]         index.php

Content of .htaccess

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} example.com
RewriteCond %{REQUEST_URI} !example.com/
RewriteRule ^(.*)$ example.com/$1 [L]


RewriteCond %{HTTP_HOST} otherexample.com
RewriteCond %{REQUEST_URI} !otherexample.com/
RewriteRule ^(.*)$ otherexample.com/$1 [L]

index.php file could be a WordPress index.php that resides in web root folder.

No comments:

Post a Comment