mod_rewrite/mod_negotiation/mod_dir interaction and SSI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there,

this is a question about Apache/2.0.52. I have content negotiation and
mod_dir working, serving stuff like dir/index.html.en or
dir/index.html.de on requests for:

dir/index.html
dir/index
dir/
dir

But I'm confused about the order in which rewrite, negotiation and dir
modules are (re)applied.

For the first two requests, the mod_rewrite variable REQUEST_FILENAME
(and SCRIPT_FILENAME) is set to path/dir/index.html.en resp.
path/dir/index.html.de. (I test this by passing it to SSI, using
mod_rewrite's E flag.)

For the latter two requests, it is set to path/dir/, even though apache
does resolve those requests in the end.

Question: Is there any way to access the final resolved path (after
content negotiation) in mod_rewrite?

Background:
I'm experimenting with per dir mod_rewrite although this stuff will end
up in server config finally, this may make a difference. I'm using rules
like

RewriteEngine on
RewriteRule     ^t(.*)/([^/]*)\.en$     -    [E=lang:en,E=brother:$2.de]
RewriteRule     ^t(.*)/([^/]*)\.de$     -    [E=lang:de,E=brother:$2.en]

in order to define language dependent environment variables which I use
in SSI. (The ^t is for restricting to test dirs.) The main problem is
defining the "brother" page, e.g. index.html.de for index.html.en and
vice versa. SSI can't do this, PHP is no-go over here. The above works
flawlessly for the 1st two requests mentioned above, but not for the
last two.

This seams to mean that content negotiation happens before mod_rewrite,
but mod_dir substitution happens after; OK, but mod_dir triggers content
negotiation (or else it would be stuck with non-existing index.html
rather than resolve to index.html.en), but this does not seem to go
through mod_rewrite any more.

Possible approaches:
- Have mod_dir->mod_neg. results go through mod_rewrite again. How?
I could use the above rules then.

- Have mod_dir->mod_neg. results available in some var which is
accessible in mod_rewrite. Which, how?
I could amend the above rules by rules matching on /$ and using that var.

Cheers,
Michael

P.S.: Additional complication: We allow index, Welcome, welcome here
with mod_dir, not only index.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux