The following was emailed to me and it worked fine for URL which resolved to
an existing file, but it's failing to do so when otherwise the URL cannot be
mapped to a physical file.

However, the 2nd motivation on removing every bit of php from the sight of
designers, seems not to be fullfilled right this way; problably more has to
be done.

BTW, I've just read the original URI is indeed passed to PHP:
>>>>>
Environment Variables
This module keeps track of two additional (non-standard) CGI/SSI environment
variables named SCRIPT_URL and SCRIPT_URI. These contain the logical
Web-view to the current resource, while the standard CGI/SSI variables
SCRIPT_NAME and SCRIPT_FILENAME contain the physical System-view.

Notice: These variables hold the URI/URL as they were initially requested,
i.e., before any rewriting. This is important because the rewriting process
is primarily used to rewrite logical URLs to physical pathnames.

Example:

SCRIPT_NAME=/sw/lib/w3s/tree/global/u/rse/.www/index.html
SCRIPT_FILENAME=/u/rse/.www/index.html
SCRIPT_URL=/u/rse/
SCRIPT_URI=http://en1.engelschall.com/u/rse/
<<<<

The message follows:

Hello Manuel,

  I am by no means an expert on mod-rewrite, but I have used it for
  doing what you are looking for.  Here is one that we use to
  translate:

    http://domain.com/yourname to
    http://domain.com/vo/vsite/index.php?VSITTE_ID=yourname

    <VirtualHost 192.168.0.4>
    *** normal stuff ***
    RewriteEngine on
    RewriteRule ^/([0-9A-Za-z_.,-]+)$ /vo/vsite/index.php?VSITE_ID=$1
    </VirtualHost>

  What this does is takes anything after the / and makes it into a query
  string that is then sent to /vo/vsite/index.php (the $1 is replaced by
  the regular expression match)


  I think what you want to do is this:

  RewriteRule ^/(.*) /foo/bar/handler.php/$1
  or
  RewriteRule ^/(.*) /foo/bar/handler.php?PATH=$1

  If this helps, or you find it to work, please post back to the list...

  I'll try to answer some questions below...

--
Best regards,
 Jason                            mailto:[EMAIL PROTECTED]

Wednesday, October 6, 2004, 11:53:26 PM, you wrote:

MVA> I'm starting to read mod_rewrite doc [1]; but in my current state
MVA> of not knowing, my mind starts popping questions like:

MVA> Does this URL to URL mapping will leave original URI visible
MVA> somewhere or somehow to PHP (ie. $_SERVER['REQUEST_URI'])?

I think you have to do that how I described above.

MVA> Does it leave the original PATH_TRANSLATED visible to PHP?

Don't know

MVA>     These Q are very important; if the answer is No, then I would have
MVA>     to make some tricks to obtain the original URI and PATH_TRANSLATED.
MVA>     My code would rely on this.

MVA> Does it do its job by sub-requesting the mapped URL? (I think this
MVA> a thumb question; otherwise mod_rewrite would work like a redirect,
MVA> but let's keep this Q)

It does it all in the server, the browser never knew what happened.

MVA> The 404 solution doesn't fit my needs. I want EVERYTHING (even if
MVA> the URI is resolved to an existing file) to get though the PHP Script
Handler.

I think I showed you how to do that above

MVA> Besides: "While URL manipulations in per-server context are really
MVA> fast and efficient, per-directory rewrites are slow and inefficient
MVA> due to this chicken and egg problem. But on the other hand this is
MVA> the only way mod_rewrite can provide (locally restricted) URL
MVA> manipulations to the average user." [1]

MVA> Others questions are now coming to my mind, so I think the time has
MVA> come for me to finish reading the mod_rewrite doc.

MVA> Thanks, (New stuff is always welcome) Manuel.


MVA> [1] http://httpd.apache.org/docs/mod/mod_rewrite.html

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to