Two domains: same files

Using a single web hosting account to host multiple sites

Two domains: same files

Postby Bart » Fri Nov 07, 2008 3:49 am

I've got two domains:
www.domain1.com
www.domain2.com

They should both use the files on:
test.domain3.com

In my files I've put a code that looks to the current link (for example: www.domain1.com) and then he looks in my database for the settings (like language and theme) of that domain.

Both domains should work on their own.

Also some files must be excluded. For example: www.domain1.com/forum must use files from www.domain1.com.

How can I do this?
Bart
 
Posts: 3
Joined: Fri Nov 07, 2008 3:41 am

Postby richardk » Fri Nov 07, 2008 12:01 pm

Are the files on different servers?
Do you have access to the server configuration?

It sounds like you will have to use mod_proxy and mod_rewrite which is inefficient. In domain1's document root
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule !^forum(/.*)?$ http://test.domain3.com%{REQUEST_URI} [P,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Bart » Fri Nov 07, 2008 12:25 pm

richardk wrote:Are the files on different servers?
The files are on one domain (on test.domain3.com). The 3 domains are on the same server.
richardk wrote:Do you have access to the server configuration?
I can ask my host to change some server configuration. Normally I specify the mod_rewrite rules in a .htaccess-file.
richardk wrote:It sounds like you will have to use mod_proxy and mod_rewrite which is inefficient. In domain1's document root
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule !^forum(/.*)?$ http://test.domain3.com%{REQUEST_URI} [P,L]
In this methode the user can't see that he is actually reading on test.domain3.com?
Bart
 
Posts: 3
Joined: Fri Nov 07, 2008 3:41 am

Postby richardk » Sun Nov 09, 2008 11:37 am

Do you have access to the server configuration?

I can ask my host to change some server configuration. Normally I specify the mod_rewrite rules in a .htaccess-file.

Only the proxy mod_rewrite will work in a .htaccess file.

You could change the domains' document roots but then all files would be the same (including /forum) so you'd have to do something to seperate them, possibly using Aliases. Would you be allowed to change the domain's <VirtualHost>s?

In this methode the user can't see that he is actually reading on test.domain3.com?

Yes.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Bart » Tue Nov 11, 2008 6:57 am

richardk wrote:
Do you have access to the server configuration?

I can ask my host to change some server configuration. Normally I specify the mod_rewrite rules in a .htaccess-file.

Only the proxy mod_rewrite will work in a .htaccess file.

You could change the domains' document roots but then all files would be the same (including /forum) so you'd have to do something to seperate them, possibly using Aliases. Would you be allowed to change the domain's <VirtualHost>s?
Yes, we can change the virtual hosts.
Bart
 
Posts: 3
Joined: Fri Nov 07, 2008 3:41 am

Postby richardk » Wed Nov 12, 2008 12:18 pm

Then you can have
Code: Select all
<VirtualHost *:80>
  ServerName example1.com
  ServerAlias www.example1.com

  DocumentRoot /where/all/the/main/files/are
  Alias /forum /where/the/forum/files/are
</VirtualHost>

<VirtualHost *:80>
  ServerName example2.com
  ServerAlias www.example2.com

  DocumentRoot /where/all/the/main/files/are
</VirtualHost>
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 17 guests

cron