]> granicus.if.org Git - apache/commitdiff
Provides an example of using expr in a RewriteCond for a commonly-requested recipe.
authorRich Bowen <rbowen@apache.org>
Fri, 14 Jan 2011 16:21:09 +0000 (16:21 +0000)
committerRich Bowen <rbowen@apache.org>
Fri, 14 Jan 2011 16:21:09 +0000 (16:21 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1059058 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/mod/mod_rewrite.xml

index fbca1dc83b4798013488f4ff32628ddb8330c076..60dad4908f382b0c5b49c8afd2bd70836b165988 100644 (file)
@@ -775,6 +775,17 @@ RewriteRule ^index\.html$  newsite.html
            <p>If the <em>TestString</em> has the special value <code>expr</code>, the
            <em>CondPattern</em> will be treated as a
            <a href="../expr.html">ap_expr</a>.</p>
+
+           <p>
+            In the below example, <code>-strmatch</code> is used to
+            compare the <code>REFERER</code> against the site hostname,
+            to block unwanted hotlinking.
+           </p>
+
+           <example>
+           RewriteCond expr "! %{HTTP_REFERER} -strmatch '*://%{HTTP_HOST}/*'"<br />
+           RewriteRule ^/images - [F]
+           </example>
         </li>
 
         <li>You can also set special flags for