LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-26-2006, 05:05 AM   #1
nephish
Member
 
Registered: Jun 2005
Distribution: arch, ubuntu
Posts: 456

Rep: Reputation: 30
three websites to share one folder - possible ?


lo there,

i have a project where i am building three websites that will work and behave the same, but need different stylesheets, and connect to different mysql databases ( set up identically ).

each site has its own domain, and i am doing this with apache virtual hosting. I want them all to share code because right now, if i expand one, i have to make the changes across three sites, which tripples my work in debugging, upgrading, etc...

So what i want, is a login page that is seperate from the others. This is where i would start a session that gives me the name of the database in a variable. Also would have a different template to load each company logo specific to that site.

What would be the easiest way for these to be set up ? I though of having the login as the index.php on each site, also the stylesheet and template, then have the rest of the site located in a sub directory, then using mount --bind to make them all the same across three sites.

Is there a better way to do this ?

thanks.
 
Old 08-26-2006, 05:10 AM   #2
Niels@debian
LQ Newbie
 
Registered: Aug 2004
Location: Laval, FR
Distribution: Debian Sarge 2.6.9
Posts: 25

Rep: Reputation: 15
The easiest way is to setup a VirtualHost with one ServerName and 2 Serveralias.

After two solutions (php use as an example) :

- The "better" way : use mod_rewrite to forward for example config.php to three differents file

Code:
RewriteRule http://test1.com/config.php /config-test1.php
RewriteRule http://test2.com/config.php /config-test2.php
...
- The easiest way :
In the php files use a switch on the var $_SERVER['HTTP_HOST'] to define the correct variables or to includes specific files.

Code:
switch($_SERVER['HTTP_HOST']){
case 'test1.com' :
include('config-test1.php');
break;
case 'test1.com' :
include('config-test1.php');
break;
 
Old 08-26-2006, 08:19 AM   #3
nephish
Member
 
Registered: Jun 2005
Distribution: arch, ubuntu
Posts: 456

Original Poster
Rep: Reputation: 30
oh cool. I believe i will go with door number 2 ( the easier way )
thanks a lot, i just knew there was a better solution than what i was going to do before. I really was not excited about putting everything in a sub-folder of a sub-folder anyway. Thanks much..
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Share A Folder madmax1143 Linux - Software 4 08-01-2006 12:17 AM
help quick! share folder vMatthews Linux - Networking 3 11-06-2005 10:57 AM
share a folder Alan87i Fedora 8 10-15-2005 04:47 PM
how to share folder with users salahuddin_66 Linux - General 4 08-11-2004 10:43 AM
how can i share a folder/file? duker_d_cooker Linux - General 3 03-10-2004 06:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration