multiple domains with subdomain on one hosting

Using a single web hosting account to host multiple sites

multiple domains with subdomain on one hosting

Postby manipulator » Wed Sep 30, 2009 11:51 am

Hello!

I want to use my hosting for 3-4 different domains with subdomains.
Could you help me to configure my .htaccess to fit this task.

Schema:

example1.com -> www.example1.com Redirect
abc.example1.com -> No Redirect

*.example1.com/{images|media} etc existed resources at example1.com directory -> use example1.com/{images|media}
*.example1.com/not existed resources at example1.com directory -> use example1.com/page.php/$1

Could you provide some advice how to handle this task.

WBR,
Tony
manipulator
 
Posts: 3
Joined: Wed Sep 30, 2009 11:00 am

Postby richardk » Wed Sep 30, 2009 1:25 pm

What happens when you go to the example1.com sub domains at the moment?
Should the same thing happen to the other domains?
Are they all going to use the same page.php?

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(example1\.com|example2\.com|example3\.com)$ [NC]
RewriteRule .* http://www.%1%{REQUEST_URI} [R=301,L]

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ /page.php/$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby manipulator » Wed Sep 30, 2009 9:49 pm

manipulator
 
Posts: 3
Joined: Wed Sep 30, 2009 11:00 am

Postby manipulator » Wed Sep 30, 2009 9:53 pm

But i need to use /www.example1.com/index.php for http://www.example1.com/details, http://abc.example1.com/details etc.
and existed resources such as http://www.example1.com/images/logo.png should be routed to /www.example1.com/images/... folder.
Last edited by manipulator on Wed Sep 30, 2009 9:56 pm, edited 1 time in total.
manipulator
 
Posts: 3
Joined: Wed Sep 30, 2009 11:00 am

Postby richardk » Thu Oct 01, 2009 8:22 am

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(example1\.com|example2\.com|example3\.com)$ [NC]
RewriteRule .* http://www.%1%{REQUEST_URI} [R=301,L]

RewriteCond %{DOCUMENT_ROOT}/example1%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}/example1%{REQUEST_URI} -d
RewriteRule . /example1%{REQUEST_URI} [QSA,L]

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.+)$ /example1/page.php/$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 29 guests

cron