Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Qs about rewrite syntax

  • 08-01-2014 2:12pm
    #1
    Registered Users Posts: 81,223 ✭✭✭✭


    I am just getting into rewriting (part of a project at work I'm involved in) and have a httpd.conf file I've been looking at

    A lot of the rules are written way before my time and the devs have moved to other companies. I've asked new devs about the syntax but they aren't sure so I thought I'd throw it up here in case someone will know better.
    This is the first of a few conds/rules I am curious about:

    RewriteCond %{HTTPS} (on)?
    RewriteCond %{HTTP_HOST} ^example.com [NC]
    RewriteRule ^/(.*) http(?%1s)://www.example.com/$1 [R=301,L]

    The first cond turns off https but what is the bracketed (on) and question mark for? Should it not just be RewriteCond %{HTTPS} on
    Also, the rule ^/(.*) is greedy and should capture example.com/justaboutanything

    What is the (?%1s) used for?
    $1 is filled from ^/(.*) yeah? And doesn't this mean a QSA is needed?


Comments

Advertisement