|
|
|
|
||||||
| comp.info.servers.unix Web servers for UNIX platforms. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I have authored several Web sites (let's call them site1.com,
site2.com...) that make liberal use of SSI includes for things like headers, etc. Most pages contain the following: <!--#include virtual="/includes/header.html" --> Now, I am trying to set up a temp copy of those sites to serve as staging areas when I make changes, so I don't play around with the live sites. They are stored under my server root at (let's call it myuser.com), in the Temp directory: / [myuser.com server root] Temp site1 includes images etc. site2 includes images etc. Problem: pages in each staging site now try to include files from the wrong directory. For example, let's take the live page: site.com/index.html whose include resolves to site.com/includes/header.html The staging version of that page, located at myuser.com/Temp/site1/index.html will want to include /includes/header.html which resolves to myuser.com/includes/header.html I want it to resolve to myuser.com/Temp/site1/includes/header.html If these were files requested by users' browsers, I could use the Apache rewrite engine to point the requests to the right directory. However, because the problem lies with server-side includes, I can't do that, right? (If I can, then I screwed up because it didn't seem to work.) So, is there a way in Apache for the server to modify the URL of #included files, so that I can keep the HTML code on the staging sites identical to that found on the live sites? P.S. I can't simply set up a link to /Temp/site1/includes/ from /includes , as each staging site has its own /includes directory -- linking the root's /includes to one staging site's correct directory would not solve the problem for the remaining staging sites. Thanks for your . |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Typo: I wrote
> For example, let's take the live page: > > site.com/index.html > > whose include resolves to > > site.com/includes/header.html I obviously meant site1.com, not site.com. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Typo: I wrote
> For example, let's take the live page: > > site.com/index.html > > whose include resolves to > > site.com/includes/header.html I obviously meant site1.com, not site.com. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Typo: I wrote
> For example, let's take the live page: > > site.com/index.html > > whose include resolves to > > site.com/includes/header.html I obviously meant site1.com, not site.com. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
|
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
blaq@blaqzone.com wrote:
> [chop - too much to read] Of course you can run SSI includes through Aliases and Rewriterules, or your operating system's equivalents. It's a technique that is used as the basis for entire publishing systems: the combination of SSI and rewrite can pull in different stories, adverts, etc into a page. -- Nick Kew |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
blaq@blaqzone.com wrote:
> [chop - too much to read] Of course you can run SSI includes through Aliases and Rewriterules, or your operating system's equivalents. It's a technique that is used as the basis for entire publishing systems: the combination of SSI and rewrite can pull in different stories, adverts, etc into a page. -- Nick Kew |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
blaq@blaqzone.com wrote:
> [chop - too much to read] Of course you can run SSI includes through Aliases and Rewriterules, or your operating system's equivalents. It's a technique that is used as the basis for entire publishing systems: the combination of SSI and rewrite can pull in different stories, adverts, etc into a page. -- Nick Kew |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
blaq@blaqzone.com wrote:
> If these were files requested by users' browsers, I could use the > Apache rewrite engine to point the requests to the right directory. > However, because the problem lies with server-side includes, I can't do > that, right? (If I can, then I screwed up because it didn't seem to > work.) Note that prior to apache 2.1 mod_rewrite used in per-dir context (i.e. ..htaccess files, <directory>-containers etc.) does not act in sub requests. But a rule in per-server context (httpd.conf, if you're using virtual hosts, inside of that <virtualhost...>-container would work. But you must not use the NS-flag, of course. So it should look like RewriteEngine on RewriteRule ^/includes/header\.html$ /Temp/site1/includes/header.html [L] -- Robert |
|
|
|
#10 |
|
Messages: n/a
Hébergeur: |
blaq@blaqzone.com wrote:
> If these were files requested by users' browsers, I could use the > Apache rewrite engine to point the requests to the right directory. > However, because the problem lies with server-side includes, I can't do > that, right? (If I can, then I screwed up because it didn't seem to > work.) Note that prior to apache 2.1 mod_rewrite used in per-dir context (i.e. ..htaccess files, <directory>-containers etc.) does not act in sub requests. But a rule in per-server context (httpd.conf, if you're using virtual hosts, inside of that <virtualhost...>-container would work. But you must not use the NS-flag, of course. So it should look like RewriteEngine on RewriteRule ^/includes/header\.html$ /Temp/site1/includes/header.html [L] -- Robert |
|
![]() |
| Outils de la discussion | |
|
|