Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.