{
  "id": "04",
  "content": [
    {
      "type": "heading",
      "text": "RewriteEngine, Conditions & Rules"
    },
    {
      "type": "text",
      "html": "The <code>mod_rewrite</code> engine enables powerful pattern\u2011based routing."
    },
    {
      "type": "text",
      "html": "<pre><code>RewriteEngine On\n# Pretty URLs: /article/123 \u2192 article.php?id=123\nRewriteRule ^article/(\\d+)$ article.php?id=$1 [L,QSA]\n\n# Only if file doesn't exist\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule ^app/(.*)$ index.php?route=$1 [L,QSA]</code></pre>"
    },
    {
      "type": "text",
      "html": "<strong>QSA</strong> appends query string; <strong>L</strong> stops processing on match."
    }
  ],
  "quiz": {
    "questions": [
      {
        "id": "q1",
        "type": "single",
        "text": "Which module powers RewriteRule?",
        "options": [
          {
            "id": "a",
            "text": "mod_php"
          },
          {
            "id": "b",
            "text": "mod_rewrite"
          },
          {
            "id": "c",
            "text": "mod_ssl"
          }
        ],
        "correct": [
          "b"
        ]
      },
      {
        "id": "q2",
        "type": "single",
        "text": "What does '!-f' in a RewriteCond test?",
        "options": [
          {
            "id": "a",
            "text": "File exists"
          },
          {
            "id": "b",
            "text": "File does not exist"
          },
          {
            "id": "c",
            "text": "Folder is writable"
          }
        ],
        "correct": [
          "b"
        ]
      },
      {
        "id": "q3",
        "type": "single",
        "text": "QSA flag means:",
        "options": [
          {
            "id": "a",
            "text": "Quit server asap"
          },
          {
            "id": "b",
            "text": "Query String Append"
          },
          {
            "id": "c",
            "text": "Quiet Status Announce"
          }
        ],
        "correct": [
          "b"
        ]
      }
    ]
  }
}