What does flag mean in htaccess file WordPress?

wordpress WordPress

When we create our blogs it is more convenient to set some rule on server-side as it will save our and server time. For these issues the best way to use htaccess file. What is htaccess file?
.htaccess is a configuration file for use on web servers running the Apache Web Server software.

So if you need to set some rules in .htaccess it is good to know flags that are used in it.

The list of htaccess flags in WordPress

  • 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)

.htaccess flags are added to the end of a rewrite rule. They are written in comma-separated way, and are contained in square brackets. The example:
[N,R,P] They tell Apache how to handle and interpret the written rule. Also 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.

The example of setting rule in htaccess file for WordPress you can find in the following post: redirect index.html to index.php

Rate article
Add a comment