On 01/05/2011 12:18 PM, Jędrzej Nowak wrote:
Configure docs, wiki 'normally' just add a docs or wiki prefix in all
types of rules for example
when normal settings for php redirection is:
(.*) =>  index.php?q=$1
Just do
^/wiki/(.*) =>  index.php?q=$1

A few more questions, specifically geared at the Redirection and RegEx processing in Cherokee... I've been successful in configuring per-directory processing behavioral rules in a single virtual server configuration, but I've as yet been unable to get any regular expressions to actually appear to match and substitute requests (causing the server-based URL rewriting for dokuwiki to effectively be inoperative).

I've stared at the RegEx for a while... comparing with what I have in production on my existing Apache server, similar pages on dokuwiki's site, and have read through Cherokee's pages on RegEx, but I'm finding another deviation between what I think should be and what actually is.. for example:

At the tail end of my behavioral rules, I have the following:

    Directory /wiki, non-final
        Handler: List and Send
        Docroot: /var/www/wiki

Followed by:

    Directory /docs, non-final
        Handler: List and Send
        Docroot: /var/www/docs

Following that, a rule to grab requests for /lib and /favicon.ico (static content, final) which handle some of the dokuwiki internals.

Lastly, in the default rule
        Handler: Redirection
Internal: ^/[a-zA-Z0-9]*/_media/(.+)\?(.+)$ Substitution: /lib/exe/fetch.php?media=$1&$2 Internal: ^/[a-zA-Z0-9]*/_media/(.+)$ Substitution: /lib/exe/fetch.php?media=$1 Internal: ^/[a-zA-Z0-9]*/_detail/(.+)\?(.+)$ Substitution: /lib/exe/detail.php?media=$1&$2 Internal: ^/[a-zA-Z0-9]*/_detail/(.+)$ Substitution: /lib/exe/detail.php?media=$1 Internal: ^/[a-zA-Z0-9]*/_export/(.+)/(.*)$ Substitution: /doku.php?do=export_$1&id=$2 Internal: ^/[a-zA-Z0-9]*/$ Substitution: /doku.php Internal: ^/[a-zA-Z0-9]*/\?(.+)$ Substitution: /doku.php?$1 Internal: ^/[a-zA-Z0-9]*/(.+)\?(.*)$ Substitution: /doku.php?id=$1&$2 Internal: ^/[a-zA-Z0-9]*/(.+)$ Substitution: /doku.php?id=$1

My understanding: This, like the rules logic that preceded, is merely a chain... a request destined for either /wiki or /docs (or basically anything I haven't tried to divert) will ultimately end up here, and try to parse the request through this list of RegEx... whichever one matches (if one matches), the substitution will take place.

As Jędrzej suggested, my rules should contain the directory name (since both /docs and /wiki pass through here, the expanding character class [a-zA-Z0-9]* should match either, or none). I will say I also have tried breaking out the RegEx individually per each directory, but with no change.

Question: If I divert the docroot in the preceding Directory rules, do these RegEx actually see the directory request, on an Internal type of redirection?

I ask because, in the logs, I see the GET, and it is for the original request, NOT what should be substituted (ie the internal doku.php?foo)... if I have a RegEx match, would it in fact show the result of the substitution of the request in the access log?

For example, if I try to access www.site.com/docs/, I get a 404, and in the log I see the following message:

    ... "GET /docs/ HTTP/1.1" 404 589 "-" ...

If I am understanding the RegEx processing correctly, this request should have matched the:
     ^/[a-zA-Z0-9]+/$

rule, and replaced it with /doku.php (off the docroot).

Just for giggles, I also put in the following rule:

    Internal: .*            Substitution: HAHA

(I also tried it as external, and also as both int/ext in additional tests using "^.*$" instead of ".*")

I am working with the assumption that I should see, in the log, the string "HAHA" appear for my request... but I do not, I just see the original literal request 404'ing.

My variations and experiments I feel have been expansive, but I am just not seeing any feedback to my Regular Expressions to enable me to feel productive in chasing down my problem. Could another rule be intercepting prior to my redirect? I don't see how... I can do specific tests for the other rules and get successful processing. It is just here, at the very end of the chain, I seem to be having some problems.

Any ideas? Suggestions? Sorry for my continued pestering, but I feel this is the last big roadblock keeping me from fully using and potentially understanding Cherokee.

Thanks.

-Matthew
_______________________________________________
Cherokee mailing list
[email protected]
http://lists.octality.com/listinfo/cherokee

Reply via email to