RewriteRule works with Redirect Flag but not without

Discussion in 'Apache' started by augury, Jul 21, 2009.

  1. #1
    My only rewriterules is as follows:
    RewriteCond %{REQUEST_URI} !^/(images|design|index.php)
    RewriteRule ^(.*[^/])$ index.php?url=$1 [R,QSA,L]

    It takes a url: site.tld/site/address
    and converts it to site.tld/?url=/site/address
    or: site.tld/site/address?abc=123
    and converts it to site.tld/?url=/site/address&abc=123

    This works great except I don't want the redirect to be visible. When I remove the R flag it creates a circular loop.

    I am at a loss. Any help would be greatly appreciated.
     
    augury, Jul 21, 2009 IP
  2. augury

    augury Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can't see the forest for the trees. Remove the R Dumbo.
     
    augury, Jul 22, 2009 IP
  3. lifetalk

    lifetalk Well-Known Member

    Messages:
    1,659
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    115
    #3
    Umm.. Are you posting a question and answering to it yourself? ^
     
    lifetalk, Jul 26, 2009 IP
  4. gostats

    gostats Peon

    Messages:
    325
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If you want to not have it redirect, please try as follows:
    (I've changed some of the regex for you)

    RewriteCond %{REQUEST_URI} ^site/(.*)
    RewriteRule ^/site/(.*) index.php?url=/site/$1 [L]

    (It could be simplified to the second line of the RewriteRule, but I think you might want to modify other rules into the RewriteCond from what I gather in the above example. I don't exactly know what you are trying to do above)
     
    gostats, Jul 30, 2009 IP
  5. National

    National Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yes use the [L] tag
     
    National, Aug 2, 2009 IP