PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.info.servers.unix > Can I redirect SSI's in a manner similar to mod_rewrite?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.info.servers.unix Web servers for UNIX platforms.

Can I redirect SSI's in a manner similar to mod_rewrite?

Réponse
 
LinkBack Outils de la discussion
Vieux 24/05/2006, 01h10   #1
blaq@blaqzone.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Can I redirect SSI's in a manner similar to mod_rewrite?

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 .

  Réponse avec citation
Vieux 24/05/2006, 05h18   #2
blaq@blaqzone.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Can I redirect SSI's in a manner similar to mod_rewrite?

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.

  Réponse avec citation
Vieux 24/05/2006, 05h18   #3
blaq@blaqzone.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Can I redirect SSI's in a manner similar to mod_rewrite?

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.

  Réponse avec citation
Vieux 24/05/2006, 05h18   #4
blaq@blaqzone.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Can I redirect SSI's in a manner similar to mod_rewrite?

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.

  Réponse avec citation
Vieux 24/05/2006, 09h53   #5
Nick Kew
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Can I redirect SSI's in a manner similar to mod_rewrite?


  Réponse avec citation
Vieux 24/05/2006, 09h53   #6
Nick Kew
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Can I redirect SSI's in a manner similar to mod_rewrite?

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
  Réponse avec citation
Vieux 24/05/2006, 09h53   #7
Nick Kew
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Can I redirect SSI's in a manner similar to mod_rewrite?

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
  Réponse avec citation
Vieux 24/05/2006, 09h53   #8
Nick Kew
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Can I redirect SSI's in a manner similar to mod_rewrite?

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
  Réponse avec citation
Vieux 25/05/2006, 12h17   #9
Robert Ionescu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Can I redirect SSI's in a manner similar to mod_rewrite?

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
  Réponse avec citation
Vieux 25/05/2006, 12h17   #10
Robert Ionescu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Can I redirect SSI's in a manner similar to mod_rewrite?

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
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 14h08.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,14384 seconds with 18 queries