SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    apache.mod_rewite, while falgs[L] set but dead-loop met?

    setting in the .htaccess

    RewriteEngine On
    RewriteRule ^b\.html$ a.html [L]
    RewriteRule ^a\.html$ b.html [L]

    but got in dead-loop forever unless httpd stop.
    the rewrite.log logged called eachother interval:

    192.168.0.11 - - [07/Apr/2005:13:15:47 --0400] [home.java.net.nl/sid#8145548][rid#81c3498/initial] (1) [per-dir /usr/local/apache/htdocs/app/] internal redirect with /b.html [INTERNAL REDIRECT]
    192.168.0.11 - - [07/Apr/2005:13:15:47 --0400] [home.java.net.nl/sid#8145548][rid#81caef8/initial/redir#1] (1) [per-dir /usr/local/apache/htdocs/app/] internal redirect with /a.html [INTERNAL REDIRECT]
    192.168.0.11 - - [07/Apr/2005:13:15:47 --0400] [home.java.net.nl/sid#8145548][rid#81cb750/initial/redir#2] (1) [per-dir /usr/local/apache/htdocs/app/] internal redirect with /b.html [INTERNAL REDIRECT]
    192.168.0.11 - - [07/Apr/2005:13:15:47 --0400] [home.java.net.nl/sid#8145548][rid#81cc650/initial/redir#3] (1) [per-dir /usr/local/apache/htdocs/app/] internal redirect with /a.html [INTERNAL REDIRECT]
    192.168.0.11 - - [07/Apr/2005:13:15:47 --0400] [home.java.net.nl/sid#8145548][rid#81cd488/initial/redir#4] (1) [per-dir /usr/local/apache/htdocs/app/] internal redirect with /b.html [INTERNAL REDIRECT]
    192.168.0.11 - - [07/Apr/2005:13:15:47 --0400] [home.java.net.nl/sid#8145548][rid#81ce438/initial/redir#5] (1) [per-dir /usr/local/apache/htdocs/app/] internal redirect with /a.html [INTERNAL REDIRECT]
    192.168.0.11 - - [07/Apr/2005:13:15:47 --0400] [home.java.net.nl/sid#8145548][rid#81cf228/initial/redir#6] (1) [per-dir /usr/local/apache/htdocs/app/] internal redirect with /b.html [INTERNAL REDIRECT]
    192.168.0.11 - - [07/Apr/2005:13:15:47 --0400] [home.java.net.nl/sid#8145548][rid#81d0370/initial/redir#7] (1) [per-dir /usr/local/apache/htdocs/app/] internal redirect with /a.html [INTERNAL REDIRECT]
    192.168.0.11 - - [07/Apr/2005:13:15:47 --0400] [home.java.net.nl/sid#8145548][rid#81d1278/initial/redir#8] (1) [per-dir /usr/local/apache/htdocs/app/] internal redirect with /b.html [INTERNAL REDIRECT]
    192.168.0.11 - - [07/Apr/2005:13:15:47 --0400] [home.java.net.nl/sid#8145548][rid#81d24b8/initial/redir#9] (1) [per-dir /usr/local/apache/htdocs/app/] internal redirect with /a.html [INTERNAL REDIRECT]
    192.168.0.11 - - [07/Apr/2005:13:15:47 --0400] [home.java.net.nl/sid#8145548][rid#81d3510/initial/redir#10] (1) [per-dir /usr/local/apache/htdocs/app/] internal redirect with /b.html [INTERNAL REDIRECT]
    192.168.0.11 - - [07/Apr/2005:13:15:47 --0400] [home.java.net.nl/sid#8145548][rid#81d4878/initial/redir#11] (1) [per-dir /usr/local/apache/htdocs/app/] internal redirect with /a.html [INTERNAL REDIRECT]
    192.168.0.11 - - [07/Apr/2005:13:15:47 --0400] [home.java.net.nl/sid#8145548][rid#81d5ad8/initial/redir#12] (1) [per-dir /usr/local/apache/htdocs/app/] internal redirect with /b.html [INTERNAL REDIRECT]
    192.168.0.11 - - [07/Apr/2005:13:15:47 --0400] [home.java.net.nl/sid#8145548][rid#81d7010/initial/redir#13] (1) [per-dir /usr/local/apache/htdocs/app/] internal redirect with /a.html [INTERNAL REDIRECT]
    192.168.0.11 - - [07/Apr/2005:13:15:47 --0400] [home.java.net.nl/sid#8145548][rid#81d8778/initial/redir#14] (1) [per-dir /usr/local/apache/htdocs/app/] internal redirect with /b.html [INTERNAL REDIRECT]

    what is my wrong, isn't [L] means the last one to match, then quick out of this request?

    Frederick

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Z,

    Naw, Last (my interpretation) is just that you're finished with a set of conditions and rules so that mod_rewrite is free to go through the rest of the rule sets without remembering the conditions. My understanding is that it will keep returning to the beginning to keep processing until NO conditions (including rule regex) are met before it finishes.

    In other words, you DID cause that loop! It's a good thing that you didn't do that on an online (production) Apache 1.x server 'cause you'd have killed it (it would have looped until the root would have killed that process) - Apache 2 has a loop counter which, by default, will stop that nonsense pretty quickly.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear DK,

    then could you should me how to let a.html->b.html;and b.html ->a.html with no confict? or just impossible?

    I just still not very clear how to "until NO conditions (including rule regex) met", I found no signals can give to the server yet.

    Frederick



    Quote Originally Posted by dklynn
    Z,

    Naw, Last (my interpretation) is just that you're finished with a set of conditions and rules so that mod_rewrite is free to go through the rest of the rule sets without remembering the conditions. My understanding is that it will keep returning to the beginning to keep processing until NO conditions (including rule regex) are met before it finishes.

    In other words, you DID cause that loop! It's a good thing that you didn't do that on an online (production) Apache 1.x server 'cause you'd have killed it (it would have looped until the root would have killed that process) - Apache 2 has a loop counter which, by default, will stop that nonsense pretty quickly.

    Regards,

    DK

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Z,

    You can't! That's like writing an infinite loop - intentionally!

    Perhaps, if you describe what you're really trying to do, it would help us to understand so we could give you a better answer - "ya can't get there from here" is patently unsatisfactory.

    What I fail to understand is WHY you'd want to do that so knowing what you've got up your sleeve would definitely help.

    Regards,

    DK
    Last edited by dklynn; Apr 7, 2005 at 14:31.
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  5. #5
    SitePoint Wizard Dean C's Avatar
    Join Date
    Mar 2003
    Location
    England, UK
    Posts
    2,906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah it's kind of strange to see why you're swapping the names via mod_rewrite when wouldn't it be better to rename them ?


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
  •