top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Why do we add Flags to the end of a rewrite rule ?

+1 vote
410 views
Why do we add Flags to the end of a rewrite rule ?
posted May 27, 2014 by Anuradha Tabyal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Flags are added to the end of a rewrite rule to tell Apache how to interpret and handle the rule. They can be used to tell Apache to treat the rule as case-insensitive, to stop processing rules if the current one matches, or a variety of other options. They are comma-separated, and contained in square brackets.

Here’s a list of the flags, with their meanings (this information is included on the cheat sheet, so no need to try to learn them all):

  • C (chained with next rule)
  • CO=cookie (set specified cookie)
  • E=var:value (set environment variable var to value)
  • F (forbidden – sends a 403 header to the user)
  • G (gone – no longer exists)
  • H=handler (set handler)
  • L (last – stop processing rules)
  • N (next – continue processing rules)
  • NC (case insensitive)
  • NE (do not escape special URL characters in output)
  • NS (ignore this rule if the request is a subrequest)
  • P (proxy – i.e., apache should grab the remote content specified in the substitution section and return it)
  • PT (pass through – use when processing URLs with additional handlers, e.g., mod_alias)
  • R (temporary redirect to new URL)
  • R=301 (permanent redirect to new URL)
  • QSA (append query string from request to substituted URL)
  • S=x (skip next x rules)
  • T=mime-type (force specified mime type)
answer Jun 9, 2014 by Aarati Mahajan
Similar Questions
+1 vote

I googled but cant figure it out.

+2 votes

I'm trying to use the new If directive present from Apache 2.4, to configure an htaccess based authentication for a specific Location based to the client IP address. If a client hasn't an IP address related to the internal VLAN, I would set the password access.

What is the correct syntax to have this configuration? I noticed on the documentation that there is the "-ipmatch" condition, but I don't understand well this feature.

+1 vote

I am getting tired of my web host changing server-wide apache config settings without warning. Then I am pulling my hair out trying to figure out why my website is not quite working as it should.

Is there a way I can use .htaccess or other method to see what the config settings are? Then I could more easily deal with what has been changed.

I realize that what I put in .htaccess will overwrite what they have put in the config, but not knowing what they are doing makes it harder for me to address the changing problems.

...