LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 07-15-2008, 06:34 PM   #1
theodm
LQ Newbie
 
Registered: Jul 2008
Posts: 6

Rep: Reputation: 0
Subdomain inherit and override


I'm wondering if the following is possible. I have a pretty big website with quite some php files (Debian server with Apache2 and PHP5). Now some subdomains have to be created that are basically a copy of the main website, but some changes here and there like extra features specific for that subdomain etc.

With a few subdomains it's fine, but if it's 50 of them, all being copies, having to make a change that goes for all is not really practical.

Due to every subdomain having specific things it doesn't seem to be that easy to set things up in a way that prevents me from having copies. The ideal thing would be if something could be done that basically checks the subdomain path for a requested file and if it's not there fallback to the main website for the file, altough of course that file may include other php files, use images etc. With htaccess rewrites I could get something done probably, but that still wouldn't be able to catch it all probably.

I guess I'm not the only one with this problem, but haven't really been able to find anything so far. Any ideas or suggestions?
 
Old 07-16-2008, 02:20 PM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
How about a standard default directory with all the pages, and then each subdomain is a series of symlinks to the originals in the standard default directory.

When you create a new site, you just mirror the tree with symlinks. When you need to customize, you remove a symlink and replace it with a modified copy of the target.
 
Old 07-17-2008, 02:35 AM   #3
theodm
LQ Newbie
 
Registered: Jul 2008
Posts: 6

Original Poster
Rep: Reputation: 0
Yes I considered doing it like that, but I think the site has about thousand files all over and it's being worked on by some Indians who probably never even heard of a symbolic link, so I wonder how long it would take for them to break something

It's too bad Apache doesn't have some kind of fallback dir or something, that you can tell it here's the site root, but if you can't find a file check there as well. You would still have to do some extra checking when doing php includes then but that's doable.

I'll do some testing with the symlink option. If I'm lucky the ftp will just overwrite the symlink when a file is uploaded with the same name instead of overwriting its target.

Thanks for sharing your thoughts!
 
Old 07-17-2008, 10:59 AM   #4
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
Well, there are hierarchies:
Code:
  1- master config
      2-.htaccess
      2- virtual hosts
         3- .htaccess
And this doesn't include Directory constructs, which are orthogonal.

You can probably accomplish some of this at the mod_rewrite level, where you dynamically determine the file to serve based upon its existence in one tree or another.

While I don't think its fair to label an entire people as incompetent, I understand that you have concerns about the competence of your particular team members. Those who can't manage a symbolic link would tremble at the site of an apache configuration manual.

Best of luck.
 
Old 07-18-2008, 07:05 AM   #5
theodm
LQ Newbie
 
Registered: Jul 2008
Posts: 6

Original Poster
Rep: Reputation: 0
I didn't mean that all Indians are like that, I was talking about this particular team

Unfortunately with ftp it just overwrites the target, so when using symbolic links it's probably just a matter of time before a mistake is made.

The few mod_rewrite things I tried haven't been successful so far, but I'll see how far I get.
 
Old 07-18-2008, 11:31 AM   #6
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
I figured you were a nice person; I meant no harm.

Sounds like a challenging situation.

mod_rewrite is not my favorite either. Mr. Engelschall is brilliant, yet writing approachable scripting languages is not best suit. But mod_rewrite is so powerful, it is worth obtaining additional learning material to help you through your situation.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Have new home directories inherit ACLs rsmccain Linux - Software 2 11-26-2007 01:39 PM
How to inherit permissions thejasondean Linux - General 8 08-31-2006 02:18 PM
LXer: And the apathetic shall inherit the earth... LXer Syndicated Linux News 0 08-20-2006 07:21 PM
Samba Won't Inherit Permissions blackrain69 Linux - Software 1 10-13-2004 01:46 AM
Inherit Permissions in Samba mslane Linux - Software 1 10-09-2003 05:37 PM

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

All times are GMT -5. The time now is 12:34 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration