|
|
|
|
||||||
| alt.apache.configuration Apache web server configuration issues. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
"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 |
|
![]() |
| Outils de la discussion | |
|
|