SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 31

Thread: question on mod_rewrite without knowing param count?

  1. #1
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    question on mod_rewrite without knowing param count?

    I'm going to try to jump on the mod_rewrite bandwagon. I am working on an application that uses index.php as a front controller and the querystring does the rest. All of the querystring tutourials I see force you to know how many paramters are coming in. In my case I don't know.

    It could just be:
    Can one build a mod_rewrite that works on an unknown number of query string params and creates
    Thanks a ton for the help.
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  2. #2
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    > Can one build a mod_rewrite that works on an unknown number of query string params and creates
    Yes and I did it but I don't remember where, I think it was inside a recent post.

    I'm doing a search and I'll post here a link to it !


    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  3. #3
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's the link:
    http://www.sitepoint.com/forums/show...45&postcount=6

    Now I'm thinking how to adapt to your needs and will post.
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  4. #4
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The correct rules can be found a #7.

    Thank You,
    Last edited by pippo; Aug 16, 2005 at 06:21.
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  5. #5
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you so much for the help. I've been in rewrite for 2 days now so forgive me if I'm slow here.

    I have it setup and logging on my win dev machine for now. I am getting a 500 error and here is the log from one request:

    The C:/development/fame_php5/trunk is the docroot. The page I asked for was: http://fame5/index.php?action=test&something=5

    I was imaginging this would get rewritten as http://fame5/test/something/5

    127.0.0.1 - - [16/Aug/2005:08:37:39 -0400] [fame5/sid#6ea670][rid#792588/initial] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:39 -0400] [fame5/sid#6ea670][rid#794000/initial/redir#1] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:39 -0400] [fame5/sid#6ea670][rid#796590/initial/redir#2] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:39 -0400] [fame5/sid#6ea670][rid#7971c0/initial/redir#3] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:39 -0400] [fame5/sid#6ea670][rid#799818/initial/redir#4] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:39 -0400] [fame5/sid#6ea670][rid#79a5c0/initial/redir#5] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:39 -0400] [fame5/sid#6ea670][rid#79d5a0/initial/redir#6] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:39 -0400] [fame5/sid#6ea670][rid#79e300/initial/redir#7] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:39 -0400] [fame5/sid#6ea670][rid#7a15f0/initial/redir#8] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:39 -0400] [fame5/sid#6ea670][rid#7a2418/initial/redir#9] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:39 -0400] [fame5/sid#6ea670][rid#7a5640/initial/redir#10] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:40 -0400] [fame5/sid#6ea670][rid#792588/initial] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/favicon.ico [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:40 -0400] [fame5/sid#6ea670][rid#795900/initial/redir#1] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:40 -0400] [fame5/sid#6ea670][rid#797d58/initial/redir#2] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:40 -0400] [fame5/sid#6ea670][rid#798990/initial/redir#3] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:40 -0400] [fame5/sid#6ea670][rid#79b538/initial/redir#4] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:40 -0400] [fame5/sid#6ea670][rid#79c1a8/initial/redir#5] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:40 -0400] [fame5/sid#6ea670][rid#79e7d8/initial/redir#6] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:40 -0400] [fame5/sid#6ea670][rid#79f4f0/initial/redir#7] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:40 -0400] [fame5/sid#6ea670][rid#7a1b40/initial/redir#8] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:40 -0400] [fame5/sid#6ea670][rid#7a2978/initial/redir#9] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:08:37:40 -0400] [fame5/sid#6ea670][rid#7a5618/initial/redir#10] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index.php [INTERNAL REDIRECT]
    I'm trying to figure out your rules. It seems you have two cases, a URL that is already in the rewritten form and one that needs to be rewritten? Any change you can explain them out a bit to help me out?
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  6. #6
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yup, testing me too on my server.

    There are some mistakes when the rules will work I will explain what they are doing
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  7. #7
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay this is working on my server

    # Your URIs look like
    # /action_name
    # /action_name/
    # /action_name/par_one/val_one
    # /action_name/par_one/val_one/
    # /action_name/par_one/val_one/par_N/val_N
    # /action_name/par_one/val_one/par_N/val_N/

    RewriteEngine On


    # We have to check that the URI is *not* /action/something
    # I have to create an internal redirection to /action because
    # I need to detect if the first piece of the URI is an action or not
    # In fact the first piece, action_name, is the action name
    # the remaining pieces are the parameters and the values
    # This rule will be executed the first time
    RewriteCond %{REQUEST_URI} !^/action/ [NC]
    RewriteRule ^([^./]+)(.*)$ /action/$1$2

    #
    # THIS IS THE LOOP
    #
    # If there is a couple of parameters and values then redirect internally
    # Example:
    # /action/action_name/par1/val1/ETC
    # will be redirected to
    # /action/action_name/ETC?par1=val1
    # and so on
    RewriteRule ^action/([^./]+)/([^./]+)/([^./]+)(.*)$ /action/$1$4?$2=$3 [QSA,L]

    # This is the last rule to be executed
    # We will have something like this
    # /action/action_name/?par1=val1&parN=valN
    # and we will force the redirection to
    # /index.php?action=action_name&par1=val1&parN=valN
    RewriteRule ^action/([^./]+)/?$ /index.php?action=$1 [QSA,L]


    My mistake was not to exclude the . point from regex so [^/] was not right [^/.] is fine, doing that we are also sure that /images/image.gif won't be parsed too, same apply to css files.


    Hope my comments are clear enough, do not hesitate to ask eventually !

    The idea behind that was to remove each couple of /parX/valX from the URI and add them to the query string.
    When there are no more couples of /parX/valX/ in the URI then we are ready to call index.php

    Remember that

    /action_name/parX
    won't be parsed

    /action_name/parX/valX/parY
    won't be parsed

    because they are incomplete URIs.


    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  8. #8
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Remember that

    /action_name/parX
    won't be parsed

    /action_name/parX/valX/parY
    won't be parsed

    because they are incomplete URIs.
    So am I basically creating URLS that if a user were to copy/paste would not work for them? Maybe I should go ahead and leave in the index.php then and just do index.php/action/parX/valX?

    Sorry if I'm misunderstanding you here.
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  9. #9
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    > /action_name/parX
    > won't be parsed
    >
    > /action_name/parX/valX/parY
    > won't be parsed
    if you type those URIs .htaccess's rules won't call index.php

    and that's because
    /action_name/parX
    ``cannot"" be translated to /index.php?action=action_name&parX=

    and /action_name/parX/valX/parY
    ``cannot"" be translated to /index.php?action=action_name&parX=valX&parY=

    are you going to use
    /research/view/listall/start/10/end
    and *not*
    /research/view/listall/start/10/end/30

    ?

    I'm not sure I'm following you.

    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  10. #10
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, each param will have a value. I'm just rethinking if I should do this since the urls the user sees will not be valid. I guess I should try to work a method that it will be valid so that if someone where to bookmark the file it would be ok.

    The basic rules are that:
    1) a page might be called without anything so just site.com/
    2) a page might be called with an index.php?action=zzz and no paramaters
    3) a page might be called with an index.php?action=zzz&paramx=valx where param & value are always in pairs and we don't know how many param/value pairs there are.

    Can a rewrite force the url like:
    www.site.com/index.php/action/paramx/valx and be a valid URL that you can still get the info out into php? I'm guessing I could parse the url for anything after *.php and get the action and param/value list from the url.
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  11. #11
    SitePoint Addict
    Join Date
    Apr 2005
    Posts
    274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pippo
    Okay this is working on my server

    # Your URIs look like
    # /action_name
    # /action_name/
    # /action_name/par_one/val_one
    # /action_name/par_one/val_one/
    # /action_name/par_one/val_one/par_N/val_N
    # /action_name/par_one/val_one/par_N/val_N/

    RewriteEngine On


    # We have to check that the URI is *not* /action/something
    # I have to create an internal redirection to /action because
    # I need to detect if the first piece of the URI is an action or not
    # In fact the first piece, action_name, is the action name
    # the remaining pieces are the parameters and the values
    # This rule will be executed the first time
    RewriteCond %{REQUEST_URI} !^/action/ [NC]
    RewriteRule ^([^./]+)(.*)$ /action/$1$2

    #
    # THIS IS THE LOOP
    #
    # If there is a couple of parameters and values then redirect internally
    # Example:
    # /action/action_name/par1/val1/ETC
    # will be redirected to
    # /action/action_name/ETC?par1=val1
    # and so on
    RewriteRule ^action/([^./]+)/([^./]+)/([^./]+)(.*)$ /action/$1$4?$2=$3 [QSA,L]

    # This is the last rule to be executed
    # We will have something like this
    # /action/action_name/?par1=val1&parN=valN
    # and we will force the redirection to
    # /index.php?action=action_name&par1=val1&parN=valN
    RewriteRule ^action/([^./]+)/?$ /index.php?action=$1 [QSA,L]


    My mistake was not to exclude the . point from regex so [^/] was not right [^/.] is fine, doing that we are also sure that /images/image.gif won't be parsed too, same apply to css files.


    Hope my comments are clear enough, do not hesitate to ask eventually !

    The idea behind that was to remove each couple of /parX/valX from the URI and add them to the query string.
    When there are no more couples of /parX/valX/ in the URI then we are ready to call index.php

    Remember that

    /action_name/parX
    won't be parsed

    /action_name/parX/valX/parY
    won't be parsed

    because they are incomplete URIs.


    This rocks I didn't even know you could make loops in mod_rewrite, no idea it had that much power!

    What if I had my parameters named 1, 2, 3, ..., n, n+1, ... and the url would be /value1/value2/value3/.../valuen/valuen+1/... and I wanted it to redirect to index.php?1=value1&2=value3&3=value3&...&n=valuen&n+1=valuen+1&... Is it possible to simply add the numbers into the loop somehow without them appearing in the request URL?

  12. #12
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pippo
    Remember that

    /action_name/parX
    won't be parsed

    /action_name/parX/valX/parY
    won't be parsed

    because they are incomplete URIs.

    Ok, I took some time away and looked at this and it makes sense. I didn't realize that the URLS you are showing are missing the Value for the Parameter. Of course this is invalid and makes perfect sense now.

    Now on my system with the URL I used to test before I get this error:
    The requested URL /action/index.php was not found on this server.

    URL = http://fame5/index.php?action=test&something=5
    Result hoping for = http://fame5/test/something/5
    I also tried http://fame5/ & http://fame5/index.php

    Any ideas?

    Thanks

    The log looks like
    127.0.0.1 - - [16/Aug/2005:17:47:19 -0400] [fame5/sid#6ea670][rid#792588/initial] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:17:47:19 -0400] [fame5/sid#6ea670][rid#793fa8/initial/redir#1] (1) [per-dir c:/development/fame_php5/trunk/] pass through c:/development/fame_php5/trunk/action
    127.0.0.1 - - [16/Aug/2005:17:47:19 -0400] [fame5/sid#6ea670][rid#792588/initial] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/favicon.ico [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:17:47:19 -0400] [fame5/sid#6ea670][rid#795650/initial/redir#1] (1) [per-dir c:/development/fame_php5/trunk/] pass through c:/development/fame_php5/trunk/action
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  13. #13
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    > The basic rules are that:
    > 1) a page might be called without anything so just site.com/
    > 2) a page might be called with an index.php?action=zzz and no paramaters
    > 3) a page might be called with an index.php?action=zzz&paramx=valx
    > where param & value are always in pairs and we don't know how many
    > param/value pairs there are.
    The rules I wrote will work for all 3 cases you showed.

    > Can a rewrite force the url like:
    > www.site.com/index.php/action/paramx/valx and be a valid URL

    Another solution, and sincerely it seems to me the best one, is to move all URI to index.php and then from index.php parse the REQUEST_URI by using the explode function (don't remember the correct php function name).

    So you just use this:

    RewriteEngine On
    # Any URI *not* containing a dot is redirect to index.php
    RewriteRule ^[^.]$ /index.php [L]

    then from index.php can be a gateway to your internal php scripts using query strings, for example.

    but index.php, being a gateway, can handle even illegal URIs or not valid parameters by showing a page saying ``sorry, your article doesn't exist".
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  14. #14
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, didn't see post #12 now looking at it
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  15. #15
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://fame5/test/something/5
    should work (on my server http://127.0.0.1/test/something/5 is working)

    I think you have to use this in your httpd.conf

    RewriteLogLevel 9

    it will fill you log, but it will give us more details

    add it, and restart apache, try to browse again, and then post the log file
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  16. #16
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I think I am mistaken in part on how mod_rewrite works. I was thinking that if someone typed in http://fame/index.php?action=test the url would magically get transformed for the user into:
    http://fame/test/

    It seems that what it actually does is translate the simple URL into the complicated one, but not the other way around.

    Sorry, still learning.

    If I comment out the first two rules you wrote it works on my machine. when I run:
    http://fame5/test/something/5

    Maybe I'm missing the point of the first checks?

    For thoroughness here is the log at level 9 asking for:
    http://fame5/test/something/5
    with all of the rules you submitted.

    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/test -> c:/development/fame_php5/trunk/test/something/5
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/test/something/5 -> test/something/5
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'test/something/5'
    (4) RewriteCond: input='/test/something/5' pattern='!^/action/' => matched
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite test/something/5 -> /action/test
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: /action/test -> /action/test/something/5
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri '/action/test/something/5'
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: /action/test -> /action/test/something/5
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri '/action/test/something/5'
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/test [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/test
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/test -> action/test
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'action/test'
    (4) RewriteCond: input='/action/test' pattern='!^/action/' => not-matched
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/test
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/test -> action/test
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri 'action/test'
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/test
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/test -> action/test
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri 'action/test'
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite action/test -> /index.php?action=test
    (3) split uri=/index.php?action=test -> uri=/index.php, args=action=test
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/index.php -> index.php
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'index.php'
    (4) RewriteCond: input='/index.php' pattern='!^/action/' => matched
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite index.php -> /action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri '/action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri '/action/index'
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'action/index'
    (4) RewriteCond: input='/action/index' pattern='!^/action/' => not-matched
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri 'action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri 'action/index'
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite action/index -> /index.php?action=index
    (3) split uri=/index.php?action=index -> uri=/index.php, args=action=index&action=test
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/index.php -> index.php
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'index.php'
    (4) RewriteCond: input='/index.php' pattern='!^/action/' => matched
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite index.php -> /action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri '/action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri '/action/index'
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'action/index'
    (4) RewriteCond: input='/action/index' pattern='!^/action/' => not-matched
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri 'action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri 'action/index'
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite action/index -> /index.php?action=index
    (3) split uri=/index.php?action=index -> uri=/index.php, args=action=index&action=index&action=test
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/index.php -> index.php
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'index.php'
    (4) RewriteCond: input='/index.php' pattern='!^/action/' => matched
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite index.php -> /action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri '/action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri '/action/index'
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'action/index'
    (4) RewriteCond: input='/action/index' pattern='!^/action/' => not-matched
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri 'action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri 'action/index'
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite action/index -> /index.php?action=index
    (3) split uri=/index.php?action=index -> uri=/index.php, args=action=index&action=index&action=index&action=test
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/index.php -> index.php
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'index.php'
    (4) RewriteCond: input='/index.php' pattern='!^/action/' => matched
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite index.php -> /action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri '/action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri '/action/index'
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'action/index'
    (4) RewriteCond: input='/action/index' pattern='!^/action/' => not-matched
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri 'action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri 'action/index'
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite action/index -> /index.php?action=index
    (3) split uri=/index.php?action=index -> uri=/index.php, args=action=index&action=index&action=index&action=index&action=test
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/index.php -> index.php
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'index.php'
    (4) RewriteCond: input='/index.php' pattern='!^/action/' => matched
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite index.php -> /action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri '/action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri '/action/index'
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index [INTERNAL REDIRECT]
    -dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/favicon.ico -> favicon.ico
    -dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'favicon.ico'
    iteCond: input='/favicon.ico' pattern='!^/action/' => matched
    -dir c:/development/fame_php5/trunk/] rewrite favicon.ico -> /action/favicon
    -dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri '/action/favicon'
    -dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri '/action/favicon'
    -dir c:/development/fame_php5/trunk/] internal redirect with /action/favicon [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/favicon
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/favicon -> action/favicon
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'action/favicon'
    (4) RewriteCond: input='/action/favicon' pattern='!^/action/' => not-matched
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/favicon
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/favicon -> action/favicon
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri 'action/favicon'
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/favicon
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/favicon -> action/favicon
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri 'action/favicon'
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite action/favicon -> /index.php?action=favicon
    (3) split uri=/index.php?action=favicon -> uri=/index.php, args=action=favicon
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/index.php -> index.php
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'index.php'
    (4) RewriteCond: input='/index.php' pattern='!^/action/' => matched
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite index.php -> /action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri '/action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri '/action/index'
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'action/index'
    (4) RewriteCond: input='/action/index' pattern='!^/action/' => not-matched
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri 'action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri 'action/index'
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite action/index -> /index.php?action=index
    (3) split uri=/index.php?action=index -> uri=/index.php, args=action=index&action=favicon
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/index.php -> index.php
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'index.php'
    (4) RewriteCond: input='/index.php' pattern='!^/action/' => matched
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite index.php -> /action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri '/action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri '/action/index'
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'action/index'
    (4) RewriteCond: input='/action/index' pattern='!^/action/' => not-matched
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri 'action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri 'action/index'
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite action/index -> /index.php?action=index
    (3) split uri=/index.php?action=index -> uri=/index.php, args=action=index&action=index&action=favicon
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/index.php -> index.php
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'index.php'
    (4) RewriteCond: input='/index.php' pattern='!^/action/' => matched
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite index.php -> /action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri '/action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri '/action/index'
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'action/index'
    (4) RewriteCond: input='/action/index' pattern='!^/action/' => not-matched
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri 'action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri 'action/index'
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite action/index -> /index.php?action=index
    (3) split uri=/index.php?action=index -> uri=/index.php, args=action=index&action=index&action=index&action=favicon
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/index.php -> index.php
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'index.php'
    (4) RewriteCond: input='/index.php' pattern='!^/action/' => matched
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite index.php -> /action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri '/action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri '/action/index'
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'action/index'
    (4) RewriteCond: input='/action/index' pattern='!^/action/' => not-matched
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri 'action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] add path-info postfix: c:/development/fame_php5/trunk/action -> c:/development/fame_php5/trunk/action/index
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/action/index -> action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri 'action/index'
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite action/index -> /index.php?action=index
    (3) split uri=/index.php?action=index -> uri=/index.php, args=action=index&action=index&action=index&action=index&action=favicon
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /index.php [INTERNAL REDIRECT]
    (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/index.php -> index.php
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'index.php'
    (4) RewriteCond: input='/index.php' pattern='!^/action/' => matched
    (2) [per-dir c:/development/fame_php5/trunk/] rewrite index.php -> /action/index
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri '/action/index'
    (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri '/action/index'
    (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index [INTERNAL REDIRECT]
    Edit: Trimmed some of the log file output to shrink it down a bit
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  17. #17
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Obviously that log is so long because there is a problem.

    The problem can be see here:

    RewriteCond: input='/index.php' pattern='!^/action/' => matched
    127.0.0.1 - - [16/Aug/2005:18:20:27 -0400] [fame5/sid#6ea670][rid#798230/initial/redir#2] (2) [per-dir c:/development/fame_php5/trunk/] rewrite index.php -> /action/index

    index.php should not be redirected to /action/index

    in fact my rules at #7 (please verify them again in detail !)

    you will find

    RewriteCond %{REQUEST_URI} !^/action/ [NC]
    RewriteRule ^([^./]+)(.*)$ /action/$1$2

    ^([^./]+)(.*)$

    means

    any URI *not* containing a dot.

    I think you used some previously rules I wrote, and that I corrected at #7.

    Check #7 again !
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  18. #18
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am sorry, I was playing with the first rules when I found out that commenting them out helped. I reset the rules back to earlier. I have included a direct copy/paste below.

    The current error when requesting http://fame5/test/something/5 is:
    The requested URL /action/index.php was not found on this server.

    I went through the log and still see /index.php to action/index.php

    internal redirect with /index.php [INTERNAL REDIRECT]
    127.0.0.1 - - [16/Aug/2005:18:51:29 -0400] [fame5/sid#6ea670][rid#79a928/initial/redir#3] (3) [per-dir c:/development/fame_php5/trunk/] strip per-dir prefix: c:/development/fame_php5/trunk/index.php -> index.php
    127.0.0.1 - - [16/Aug/2005:18:51:29 -0400] [fame5/sid#6ea670][rid#79a928/initial/redir#3] (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^([^./]+)(.*)$' to uri 'index.php'
    127.0.0.1 - - [16/Aug/2005:18:51:29 -0400] [fame5/sid#6ea670][rid#79a928/initial/redir#3] (4) RewriteCond: input='/index.php' pattern='!^/action/' => matched
    127.0.0.1 - - [16/Aug/2005:18:51:29 -0400] [fame5/sid#6ea670][rid#79a928/initial/redir#3] (2) [per-dir c:/development/fame_php5/trunk/] rewrite index.php -> /action/index.php
    127.0.0.1 - - [16/Aug/2005:18:51:29 -0400] [fame5/sid#6ea670][rid#79a928/initial/redir#3] (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/([^./]+)/([^./]+)(.*)$' to uri '/action/index.php'
    127.0.0.1 - - [16/Aug/2005:18:51:29 -0400] [fame5/sid#6ea670][rid#79a928/initial/redir#3] (3) [per-dir c:/development/fame_php5/trunk/] applying pattern '^action/([^./]+)/?$' to uri '/action/index.php'
    127.0.0.1 - - [16/Aug/2005:18:51:29 -0400] [fame5/sid#6ea670][rid#79a928/initial/redir#3] (1) [per-dir c:/development/fame_php5/trunk/] internal redirect with /action/index.php [INTERNAL REDIRECT]
    Here is a copy/paste of the .htaccess
    <IfModule mod_rewrite.c>
    # Your URIs look like
    # /action_name
    # /action_name/
    # /action_name/par_one/val_one
    # /action_name/par_one/val_one/
    # /action_name/par_one/val_one/par_N/val_N
    # /action_name/par_one/val_one/par_N/val_N/

    RewriteEngine On

    # We have to check that the URI is *not* /action/something
    # I have to create an internal redirection to /action because
    # I need to detect if the first piece of the URI is an action or not
    # In fact the first piece, action_name, is the action name
    # the remaining pieces are the parameters and the values
    # This rule will be executed the first time
    RewriteCond %{REQUEST_URI} !^/action/ [NC]
    RewriteRule ^([^./]+)(.*)$ /action/$1$2

    #
    # THIS IS THE LOOP
    #
    # If there is a couple of parameters and values then redirect internally
    # Example:
    # /action/action_name/par1/val1/ETC
    # will be redirected to
    # /action/action_name/ETC?par1=val1
    # and so on
    RewriteRule ^action/([^./]+)/([^./]+)/([^./]+)(.*)$ /action/$1$4?$2=$3 [QSA,L]

    # This is the last rule to be executed
    # We will have something like this
    # /action/action_name/?par1=val1&parN=valN
    # and we will force the redirection to
    # /index.php?action=action_name&par1=val1&parN=valN
    RewriteRule ^action/([^./]+)/?$ /index.php?action=$1 [QSA,L]
    </IfModule>
    I just want to say again I really appreciate your help on this.
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  19. #19
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yup, my mistake I'm working on it.

    The rules I tried on my server forced an external redirection because I don't have php installed.

    I'm working on it (it's 1:am, though) right now to see why you have that error message.
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  20. #20
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I've been playing with this rule:
    RewriteRule ^([^./]+)(.*)$ /action/$1$2

    Coming in is index.php
    index is being matched by ([^./]+) as $1
    .php is being matched by ).*) and this index.php is getting assembled after /action.

    What I can't see is what is supposed to be here. You stated the rule should match a uri without a dot. To do that I would use ^([^.]+)$

    When I do that things work again. I don't see why you would need $1$2 though. It would seem just $1?
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  21. #21
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh wow, not a problem man. It's 7pm here. Just doing some more work from home.

    we can pick this up where we left off tomorrow if you'd like. I should be putting this away anyway.

    Again thanks.
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  22. #22
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, found the bug:

    RewriteEngine On

    RewriteCond %{REQUEST_URI} !^/action/ [NC]
    RewriteRule ^([^./]+)([^.]*)$ /action/$1$2

    RewriteRule ^action/([^./]+)/([^./]+)/([^./]+)(.*)$ /action/$1$4?$2=$3 [QSA,L]

    RewriteRule ^action/([^./]+)/?$ /index.php?action=$1 [QSA,L]


    I tested those and they worked on the same your condition.



    p.s.
    I had to edit the first RewriteRule !
    In pratice /index.php?ETC
    was mistankly redirected to /action/index.php?ETC
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  23. #23
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sweetness!

    Thanks, that's working out peachy here. I think this is going to make the app urls much much cleaner.
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  24. #24
    SitePoint Member omega13's Avatar
    Join Date
    Sep 2004
    Location
    Florida, USA
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Whats the best way to do the above without the action part being hardcoded?
    i.e. parse everything after index.php? and not just index.php?action=

  25. #25
    SitePoint Evangelist
    Join Date
    Aug 2005
    Posts
    512
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have written something a little similar last year.

    This should let you use:
    http://host.net/aa/bb/cc/dd
    instead of:
    http://host.net/index.php?aa=bb&cc=dd

    Here is inefficient but flexible version.
    This one can treat any number of parameters.
    Code:
    RewriteEngine on
    Options +Followsymlinks
    RewriteBase /
    RewriteRule ^/*index.php - [L]
    RewriteRule ^/*([^/]+)/+([^/]+)(.*)/*$ $3?$1=$2 [L,QSA]
    RewriteRule ^([^/]+)$ index.php?$1 [L,QSA]
    Trying to double the parameters treated in one round.
    Code:
    RewriteEngine on
    Options +Followsymlinks
    RewriteBase /
    RewriteRule ^/*index.php - [L]
    RewriteRule ^/*([^/]+)/+([^/]+)/+([^/]+)/+([^/]+)(.*)/*$ $5?$1=$2&$3=$4 [L,QSA]
    RewriteRule ^([^/]+)$ index.php?$1 [L,QSA]
    Although the string parsing power of mod_rewrite is not that bad,
    it should be much easier to do your own parsing in php
    using $_SERVER{QUERY_STRING} or $_SERVER{REQUEST_URI} and other variables.
    Last edited by extras; Aug 18, 2005 at 13:10. Reason: Posting the code instead of simply linking to the code...
    Freebie/DonationWare: check-these.info
    Custom solutions: Hostwick.com

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •