Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Building a dynamic white-label site on Apache 2.4.x |
|
Author |
|
CodeClimber
Joined: 29 Oct 2014 Posts: 1
|
Posted: Wed 29 Oct '14 17:31 Post subject: Building a dynamic white-label site on Apache 2.4.x |
|
|
Hi.
How do I architect and design a dynamic, white-label website i.e. a site where the components are dynamic based on a path component in the URL?
For example, requests to these endpoints:
would both resolve to the same HTML file on Apache but load different CSS and display different images, text etc. based on the prog1/prog2 component of the URL path.
====
I have come up with a solution using RewriteRules but am not sure this is the best way to go about this:
Let's call each implementation of the white label site a program.
On Apache there will be a /core directory where all static content lives:
Each program will have it's own directory in Apache to host program-specific content:
Quote: | /prog1/image1.png
/prog2/image1.png |
In the core pages (index.html for example), links to dynamic white-label content look something like this:
Quote: | <img src="./dynamic/image1.png"/> | i.e. a relative link
On Apache, I implement Rewrite rules for all the programs:
Quote: | RewriteRule ^/prog1/dynamic/(.*)$ /prog1/dynamic/$1 [PT]
RewriteRule ^/prog2/dynamic/(.*)$ /prog2/dynamic/$1 [PT]
RewriteRule ^/prog1/(.*)$ /core/$1 [PT]
RewriteRule ^/prog2/(.*)$ /core/$1 [PT] |
essentially directing all requests for dynamic content into the program-specific folders on Apache and all requests for static content into the core folder on Apache.
====
Is this the best way to do this? What other options do the various Apache modules provide that might provide a better approach? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Wed 05 Nov '14 11:38 Post subject: |
|
|
I wonder why you don't run all requests through a single file and handle the output with the server scripting language of your choise. |
|
Back to top |
|
|
|
|
|
|