From: Rich Bowen Date: Fri, 14 Jan 2011 21:02:54 +0000 (+0000) Subject: Remove unnecessary use of
 in  blocks.
X-Git-Tag: 2.3.11~204
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9883cc15333d20d5c1fc02329d01e28a40cd6bef;p=apache

Remove unnecessary use of 
 in  blocks.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1059165 13f79535-47bb-0310-9956-ffa450edef68
---

diff --git a/docs/manual/rewrite/access.xml b/docs/manual/rewrite/access.xml
index f51b155ad5..c6fe5aa3a9 100644
--- a/docs/manual/rewrite/access.xml
+++ b/docs/manual/rewrite/access.xml
@@ -81,29 +81,29 @@ configuration.
     initiate from a page on our site. For the purpose of this example,
     we assume that our site is www.example.com.

-
-RewriteCond %{HTTP_REFERER} !^$
-RewriteCond %{HTTP_REFERER} !www.example.com [NC]
+
+RewriteCond %{HTTP_REFERER} !^$
+RewriteCond %{HTTP_REFERER} !www.example.com [NC]
RewriteRule \.(gif|jpg|png)$ - [F,NC] -
+

In this second example, instead of failing the request, we display an alternate image instead.

-
-RewriteCond %{HTTP_REFERER} !^$
-RewriteCond %{HTTP_REFERER} !www.example.com [NC]
+
+RewriteCond %{HTTP_REFERER} !^$
+RewriteCond %{HTTP_REFERER} !www.example.com [NC]
RewriteRule \.(gif|jpg|png)$ /images/go-away.png [R,NC] -
+

In the third example, we redirect the request to an image on some other site.

-
-RewriteCond %{HTTP_REFERER} !^$
-RewriteCond %{HTTP_REFERER} !www.example.com [NC]
+
+RewriteCond %{HTTP_REFERER} !^$
+RewriteCond %{HTTP_REFERER} !www.example.com [NC]
RewriteRule \.(gif|jpg|png)$ http://other.example.com/image.gif [R,NC] -
+

Of these techniques, the last two tend to be the most effective in getting people to stop hotlinking your images, because they will @@ -168,11 +168,11 @@ RewriteRule \.(gif|jpg|png)$ http://other.example.com/image.gif range, if you are trying to block that user agent only from the particular source.

-
-RewriteCond %{HTTP_USER_AGENT}   ^NameOfBadRobot
-RewriteCond %{REMOTE_ADDR}       =123\.45\.67\.[8-9]
+
+RewriteCond %{HTTP_USER_AGENT}   ^NameOfBadRobot
+RewriteCond %{REMOTE_ADDR} =123\.45\.67\.[8-9]
RewriteRule ^/secret/files/ - [F] -
+
Discussion:
@@ -219,27 +219,27 @@ RewriteRule ^/secret/files/ - [F]
Solution:
-
-RewriteEngine on
-RewriteMap    hosts-deny  txt:/path/to/hosts.deny
-RewriteCond   ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND [OR]
-RewriteCond   ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND
+
+RewriteEngine on
+RewriteMap hosts-deny txt:/path/to/hosts.deny
+RewriteCond ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND [OR]
+RewriteCond ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND
RewriteRule ^ - [F] -
- -
-##
-##  hosts.deny
-##
-##  ATTENTION! This is a map, not a list, even when we treat it as such.
-##             mod_rewrite parses it for key/value pairs, so at least a
-##             dummy value "-" must be present for each entry.
-##
-
-193.102.180.41 -
-bsdti1.sdm.de  -
-192.76.162.40  -
-
+ + + +##
+## hosts.deny
+##
+## ATTENTION! This is a map, not a list, even when we treat it as such.
+## mod_rewrite parses it for key/value pairs, so at least a
+## dummy value "-" must be present for each entry.
+##
+
+193.102.180.41 -
+bsdti1.sdm.de -
+192.76.162.40 -
+
Discussion:
@@ -273,31 +273,31 @@ bsdti1.sdm.de -

The following ruleset uses a map file to associate each Referer with a redirection target.

-
-RewriteMap  deflector txt:/path/to/deflector.map
-
-RewriteCond %{HTTP_REFERER} !=""
-RewriteCond ${deflector:%{HTTP_REFERER}} =-
-RewriteRule ^ %{HTTP_REFERER} [R,L]
-
-RewriteCond %{HTTP_REFERER} !=""
-RewriteCond ${deflector:%{HTTP_REFERER}|NOT-FOUND} !=NOT-FOUND
+
+RewriteMap  deflector txt:/path/to/deflector.map
+
+RewriteCond %{HTTP_REFERER} !=""
+RewriteCond ${deflector:%{HTTP_REFERER}} =-
+RewriteRule ^ %{HTTP_REFERER} [R,L]
+
+RewriteCond %{HTTP_REFERER} !=""
+RewriteCond ${deflector:%{HTTP_REFERER}|NOT-FOUND} !=NOT-FOUND
RewriteRule ^.* ${deflector:%{HTTP_REFERER}} [R,L] -
+

The map file lists redirection targets for each referer, or, if we just wish to redirect back to where they came from, a "-" is placed in the map:

-
-##
-##  deflector.map
-##
-
-http://badguys.example.com/bad/index.html    -
-http://badguys.example.com/bad/index2.html   -
+
+##
+## deflector.map
+##
+
+http://badguys.example.com/bad/index.html -
+http://badguys.example.com/bad/index2.html -
http://badguys.example.com/bad/index3.html http://somewhere.example.com/ -
+ diff --git a/docs/manual/rewrite/vhosts.xml b/docs/manual/rewrite/vhosts.xml index 48adf03b17..76e69a0832 100644 --- a/docs/manual/rewrite/vhosts.xml +++ b/docs/manual/rewrite/vhosts.xml @@ -71,14 +71,14 @@ mod_rewrite document.
-
-RewriteEngine on
-
-RewriteMap    lowercase int:tolower
-
-RewriteCond   %{lowercase:%{HTTP_HOST}}   ^www\.([^.]+)\.example\.com$
+
+RewriteEngine on
+
+RewriteMap lowercase int:tolower
+
+RewriteCond %{lowercase:%{HTTP_HOST}} ^www\.([^.]+)\.example\.com$
RewriteRule ^(.*) /home/%1/www$1 -
+
Discussion