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)

    Actually I still confused in rewritecond& rewriterule

    I am actually not very clearly after the mass source reading.
    1.as long as the rewriterule as :
    RewriteRule ^b\.html$ a.html [L]
    RewriteRule ^a\.html$ b.html [L]
    it means the two rules work independant,right?
    as:
    RewriteRule ^b\.html$ a.html [C]
    RewriteRule ^a\.html$ c.html [L]

    if means b->a ->c right? my problems.

    regarding to the RewriteCond;
    RewriteCond A;
    RewriteCond B;
    RewriteRule no1;
    it means if(A&&B) then no1; right?

    RewriteCond A [OR];
    RewriteCond B;
    RewriteRule no1;
    it means if(A||B) then no1; right?

    then how about:
    RewriteCond A;
    RewriteRule no1;
    RewriteCond B;
    RewriteRule no2;
    it means
    if(A) then no1; else if(B) no2;
    is'nt right?

    what I confused in? I can not suffer what the exactly container/context/namingspace in the rewriteCond/rewriteRule.

    and about the .htaccess, what different between the
    rewriterule/cond set in the httpd.conf/rootplain Vs the $DocumentRoot/.htaccess???

    then how about the different in the Virutalhost documentRoot Vs its $VirtualHostDocumentRoot/.htaccess??

    That is it, may be I have not caught the whole threads how to defined in precise, I always feel something short, to defined to rules for engine to work exactly, with no misunderstand.

    Frederick

  2. #2
    SitePoint Guru gavwvin's Avatar
    Join Date
    Nov 2004
    Location
    Cornwall, UK
    Posts
    686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    RewriteCond A;
    RewriteRule no1;
    RewriteCond B;
    RewriteRule no2;
    I believe this would be
    if(A) then no1;
    if(B) then no2;
    When you put RewriteRule it forgets everything it did before and starts a new rule (I think).

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

    Actually, I believe that mod_rewrite keeps going through the rules until it gets to the end so that ZCoral was right.

    Using the Last flag terminates that set of conditions but allows mod_rewrite to keep truckin' through the rules while the Next flag would tell Apache to go back and start at the beginning.

    pippo's around tonight so he might be able to verify (or correct) on this one.

    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

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

    Dose some flags just tell apache "hello, well done, just response this request after this match", I though it is "[L]",but...$^&%^&#..., why my test before can lost in one dead-loop?

    Quote Originally Posted by dklynn
    Gav,

    Actually, I believe that mod_rewrite keeps going through the rules until it gets to the end so that ZCoral was right.

    Using the Last flag terminates that set of conditions but allows mod_rewrite to keep truckin' through the rules while the Next flag would tell Apache to go back and start at the beginning.

    pippo's around tonight so he might be able to verify (or correct) on this one.

    Regards,

    DK
    http://www.sitepoint.com/forums/showthread.php?t=251053 http://www.sitepoint.com/forums/showthread.php?t=251053

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

    Quote Originally Posted by ZCoral
    Dose some flags just tell apache "hello, well done, just response this request after this match", I though it is "[L]",but...$^&%^&#..., why my test before can lost in one dead-loop?
    Naw, that would be too simple! Consider the Last flag to be the terminating bracket for a set of RewriteCond(itions) and RewriteRule(s) (which doesn't need an opening bracket. In contrast, the Next flag tells Apache to restart the rewrite rules from the beginning (which it will do anyway but only after going through the remainder of the rules otherwise).

    May I suggest that you take a look at Apache's guide to mod_rewrite (with plenty of good examples).

    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


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
  •