Multiple domains again

Using a single web hosting account to host multiple sites

Multiple domains again

Postby mr_logic » Fri Nov 30, 2007 7:09 am

Hi!

My directory structure on the server looks as follows:
Code: Select all
/sites/commonlibs - shared libraries for all sites
/sites/site1
/sites/site2
...


I have two domains, for example www.site1.com and www.site2.com.
Those domains MUST be bound to folder /sites/ on the server.
(otherwise sites'll have no access to commonlibs)


So, if somebody types www.site1.com it should use /sites/site1 (not /sites/) and if somebody types www.site2.com it should use /sites/site2.

How should the .htaccess file in /sites/ folder look like? :(

Thank you for your support
Michael
mr_logic
 
Posts: 3
Joined: Fri Nov 30, 2007 7:01 am

Postby richardk » Fri Nov 30, 2007 3:39 pm

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST}/site1 ^(www\.)?site1\.com(/site1)$ [NC,OR]
RewriteCond %{HTTP_HOST}/site2 ^(www\.)?site2\.com(/site2)$ [NC]
RewriteCond %{DOCUMENT_ROOT}%2/$1/ -d
RewriteRule ^(.*[^/])$ /$1/ [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST}/site1 ^(www\.)?site1\.com(/site1)$ [NC,OR]
RewriteCond %{HTTP_HOST}/site2 ^(www\.)?site2\.com(/site2)$ [NC]
RewriteRule ^(.*)$ /%2/$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby mr_logic » Sat Dec 01, 2007 1:20 am

My domain is mojekontakty.com.pl (bound to /sites/) and it should point to directory /sites/mojekontakty/.

I made this, but server responses `error 500` :(

Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST}/mojekontakty ^(www\.)?mojekontakty\.com\.pl(/mojekontakty)$ [NC,OR]
RewriteCond %{DOCUMENT_ROOT}%2/$1/ -d
RewriteRule ^(.*[^/])$ /$1/ [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST}/mojekontakty ^(www\.)?mojekontakty\.com\.pl(/mojekontakty)$ [NC,OR]
RewriteRule ^(.*)$ /%2/$1 [QSA,L]
mr_logic
 
Posts: 3
Joined: Fri Nov 30, 2007 7:01 am

Postby mr_logic » Sat Dec 01, 2007 12:29 pm

ok problem solved.. i used php instead of mod_rewrite.

c'ya
mr_logic
 
Posts: 3
Joined: Fri Nov 30, 2007 7:01 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 2 guests

cron