PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > alt.apache.configuration > mod_rewrite conceptual question - substitution context
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
alt.apache.configuration Apache web server configuration issues.

mod_rewrite conceptual question - substitution context

Réponse
 
LinkBack Outils de la discussion
Vieux 09/02/2007, 20h13   #1
geoffalot
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut mod_rewrite conceptual question - substitution context

Suppose the following RewriteRule exists: (and ignoring for the moment
that the pattern and substitution are hard-coded)

RewriteRule ^categoryname/itemname index.shtml?
categoryGuid=42&itemGuid=cf34b0c1-e215-4d4c-aede-b53ba6256da0

Now suppose that index.shtml has links to assets such as images and
javascript files.
When the rule executes, index.shtml is now being executed in the
context of categoryname/itemname - so if the asset links on
index.shtml are not absolute, they will fail.

Is there a switch or some other type of mechanism through which the
resultant path can be executed in its own (in this case, root)
context? The servers this will be hosted on deliver the site content
through a variety of paths, such that index.shtml might be served from
root, or from /path/subpath/index.shtml, etc, etc - thus, I can't
write absolute paths for the asset links.

Thanks for any ,

Geoff

  Réponse avec citation
Vieux 09/02/2007, 20h37   #2
Rik
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: mod_rewrite conceptual question - substitution context

On Fri, 09 Feb 2007 21:13:39 +0100, geoffalot <geoff.moller@gmail.com>
wrote:

> Suppose the following RewriteRule exists: (and ignoring for the moment
> that the pattern and substitution are hard-coded)
>
> RewriteRule ^categoryname/itemname index.shtml?
> categoryGuid=42&itemGuid=cf34b0c1-e215-4d4c-aede-b53ba6256da0
>
> Now suppose that index.shtml has links to assets such as images and
> javascript files.
> When the rule executes, index.shtml is now being executed in the
> context of categoryname/itemname - so if the asset links on
> index.shtml are not absolute, they will fail.
>
> Is there a switch or some other type of mechanism through which the
> resultant path can be executed in its own (in this case, root)
> context? The servers this will be hosted on deliver the site content
> through a variety of paths, such that index.shtml might be served from
> root, or from /path/subpath/index.shtml, etc, etc - thus, I can't
> write absolute paths for the asset links.


Nope, images/script/css etc. are different requests to the server. You
might use a <base> tag in the html. Just serving everything from the root
by having '/path/to/file' url's (instead of './','../' etc.) is preferable
though.
--
Rik Wasmus
  Réponse avec citation
Vieux 09/02/2007, 22h30   #3
HansH
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: mod_rewrite conceptual question - substitution context

"geoffalot" <geoff.moller@gmail.com> schreef in bericht
news:1171052019.269129.105290@q2g2000cwa.googlegro ups.com...
> Suppose the following RewriteRule exists: (and ignoring for the moment
> that the pattern and substitution are hard-coded)
>
> RewriteRule ^categoryname/itemname index.shtml?
> categoryGuid=42&itemGuid=cf34b0c1-e215-4d4c-aede-b53ba6256da0
>
> Now suppose that index.shtml has links to assets such as images and
> javascript files.
> When the rule executes, index.shtml is now being executed in the
> context of categoryname/itemname - so if the asset links on
> index.shtml are not absolute, they will fail.
>

No, the concept of mod_rewrite is to change the mapping of an url to a local
file _without_ telling the browser, quite like alias or aliasmatch do. The
browser -being ignorant about the server-side diversion- will still resolve
relative links to the path of its previous request.

It's voodoo ...http://httpd.apache.org/docs/2.2/rewrite/
beyond the basic remapping it is able to send a redirect to the browser or
act as a reverse proxy


However, the given extention '.shtml' indicates mod_include is likely used
too.
I think -with absolutely NO certainty- <!--#include virtual="..." --> will
handle links relative to the URL of the current request.


HansH


  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 10h48.


É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,10444 seconds with 11 queries