From 8cc01b7ecccc81a842dce2bbabd6be441989972e Mon Sep 17 00:00:00 2001 From: Rich Bowen Date: Fri, 14 Jan 2011 21:13:24 +0000 Subject: [PATCH] Remove unncessary
 tags inside  blocks.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1059169 13f79535-47bb-0310-9956-ffa450edef68
---
 docs/manual/rewrite/remapping.xml | 200 +++++++++++++++---------------
 1 file changed, 100 insertions(+), 100 deletions(-)

diff --git a/docs/manual/rewrite/remapping.xml b/docs/manual/rewrite/remapping.xml
index 7b97562617..423ef5d763 100644
--- a/docs/manual/rewrite/remapping.xml
+++ b/docs/manual/rewrite/remapping.xml
@@ -71,10 +71,10 @@ configuration.
       

We rewrite the old URL to the new one internally via the following rule:

-
-RewriteEngine  on
+
+RewriteEngine  on
RewriteRule ^/old\.html$ /new.html [PT] -
+
@@ -102,10 +102,10 @@ RewriteRule ^/old\.html$ /new.html [PT]

We force a HTTP redirect to the new URL which leads to a change of the browsers and thus the users view:

-
-RewriteEngine  on
+
+RewriteEngine  on
RewriteRule ^/foo\.html$ bar.html [R] -
+
Discussion
@@ -145,18 +145,18 @@ RewriteRule ^/foo\.html$ bar.html [ -With mod_rewrite
-RewriteEngine on
+With mod_rewrite
+RewriteEngine on
RewriteRule ^/docs/(.+) http://new.example.com/docs/$1 [R,L] -
+ -With RedirectMatch
+With RedirectMatch
 RedirectMatch ^/docs/(.*) http://new.example.com/docs/$1
-
+ With Redirect
 Redirect /docs/ http://new.example.com/docs/
-
+ @@ -186,11 +186,11 @@ Redirect /docs/ http://new.example.com/docs/ internally leads to the invocation of /~quux/foo.cgi.

-
-RewriteEngine  on
-RewriteBase    /~quux/
+
+RewriteEngine  on
+RewriteBase /~quux/
RewriteRule ^foo\.html$ foo.cgi [H=cgi-script] -
+ @@ -217,19 +217,21 @@ RewriteRule ^foo\.html$ foo.cgi [H= -
-#   backward compatibility ruleset for
-#   rewriting document.html to document.php
-#   when and only when document.php exists
-<Directory /var/www/htdocs>
-RewriteEngine on
-RewriteBase /var/www/htdocs
-
-RewriteCond $1.php -f
-RewriteCond $1.html !-f
-RewriteRule ^(.*).html$ $1.php
+
+#   backward compatibility ruleset for
+# rewriting document.html to document.php
+# when and only when document.php exists
+<Directory /var/www/htdocs>
+ +RewriteEngine on
+RewriteBase /var/www/htdocs
+
+RewriteCond $1.php -f
+RewriteCond $1.html !-f
+RewriteRule ^(.*).html$ $1.php
+
</Directory> -
+
Discussion
@@ -322,19 +324,19 @@ Redirect /admin/ https://www.example.com/admin/ you might use one of the recipes below.

For sites running on a port other than 80:

-
-RewriteCond %{HTTP_HOST}   !^www\.example\.com [NC]
-RewriteCond %{HTTP_HOST}   !^$
-RewriteCond %{SERVER_PORT} !^80$
+
+RewriteCond %{HTTP_HOST}   !^www\.example\.com [NC]
+RewriteCond %{HTTP_HOST} !^$
+RewriteCond %{SERVER_PORT} !^80$
RewriteRule ^/?(.*) http://www.example.com:%{SERVER_PORT}/$1 [L,R,NE] -
+

And for a site running on port 80

-
-RewriteCond %{HTTP_HOST}   !^www\.example\.com [NC]
-RewriteCond %{HTTP_HOST}   !^$
+
+RewriteCond %{HTTP_HOST}   !^www\.example\.com [NC]
+RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/?(.*) http://www.example.com/$1 [L,R,NE] -
+

If you wanted to do this generically for all domain names - that @@ -343,11 +345,11 @@ RewriteRule ^/?(.*) http://www.example.com/$1 [L,R,NE] example.com, you could use the following recipe:

-
-RewriteCond %{HTTP_HOST} !^www\. [NC]
-RewriteCond %{HTTP_HOST} !^$
+
+RewriteCond %{HTTP_HOST} !^www\. [NC]
+RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/?(.*) http://www.%{HTTP_HOST}/$1 [L,R,NE] -
+

These rulesets will work either in your main server configuration file, or in a .htaccess file placed in the -

-RewriteEngine on
-
-#   first try to find it in dir1/...
-#   ...and if found stop and be happy:
-RewriteCond         %{DOCUMENT_ROOT}/dir1/%{REQUEST_URI}  -f
-RewriteRule  ^(.+)  %{DOCUMENT_ROOT}/dir1/$1  [L]
-
-#   second try to find it in dir2/...
-#   ...and if found stop and be happy:
-RewriteCond         %{DOCUMENT_ROOT}/dir2/%{REQUEST_URI}  -f
-RewriteRule  ^(.+)  %{DOCUMENT_ROOT}/dir2/$1  [L]
-
-#   else go on for other Alias or ScriptAlias directives,
-#   etc.
+
+RewriteEngine on
+
+# first try to find it in dir1/...
+# ...and if found stop and be happy:
+RewriteCond %{DOCUMENT_ROOT}/dir1/%{REQUEST_URI} -f
+RewriteRule ^(.+) %{DOCUMENT_ROOT}/dir1/$1 [L]
+
+# second try to find it in dir2/...
+# ...and if found stop and be happy:
+RewriteCond %{DOCUMENT_ROOT}/dir2/%{REQUEST_URI} -f
+RewriteRule ^(.+) %{DOCUMENT_ROOT}/dir2/$1 [L]
+
+# else go on for other Alias or ScriptAlias directives,
+# etc.
RewriteRule ^ - [PT] -
+ @@ -422,22 +424,22 @@ RewriteRule ^ - [PT]

We'll use a RewriteMap directive to build a list of servers that we wish to use.

-
-HostnameLookups on
-RewriteEngine on
-RewriteMap    multiplex         txt:/path/to/map.mirrors
-RewriteCond  %{REMOTE_HOST}     ([a-z]+)$ [NC]
+
+HostnameLookups on
+RewriteEngine on
+RewriteMap multiplex txt:/path/to/map.mirrors
+RewriteCond %{REMOTE_HOST} ([a-z]+)$ [NC]
RewriteRule ^/(.*)$ ${multiplex:%1|http://www.example.com/}$1 [R,L] -
- -
-##  map.mirrors -- Multiplexing Map
+
 
-de        http://www.example.de/
-uk        http://www.example.uk/
-com       http://www.example.com/
+
+##  map.mirrors -- Multiplexing Map
+
+de http://www.example.de/
+uk http://www.example.uk/
+com http://www.example.com/
##EOF## -
+
Discussion
@@ -482,16 +484,16 @@ com http://www.example.com/ All other browsers receive page foo.32.html. This is done with the following ruleset:

-
-RewriteCond %{HTTP_USER_AGENT}  ^Mozilla/3.*
-RewriteRule ^foo\.html$         foo.NS.html          [L]
-
-RewriteCond %{HTTP_USER_AGENT}  ^Lynx/.*         [OR]
-RewriteCond %{HTTP_USER_AGENT}  ^Mozilla/[12].*
-RewriteRule ^foo\.html$         foo.20.html          [L]
-
+
+RewriteCond %{HTTP_USER_AGENT}  ^Mozilla/3.*
+RewriteRule ^foo\.html$ foo.NS.html [L]
+
+RewriteCond %{HTTP_USER_AGENT} ^Lynx/.* [OR]
+RewriteCond %{HTTP_USER_AGENT} ^Mozilla/[12].*
+RewriteRule ^foo\.html$ foo.20.html [L]
+
RewriteRule ^foo\.html$ foo.32.html [L] -
+ @@ -522,9 +524,9 @@ RewriteRule ^foo\.html$ foo.32.html [L we replace /puppies and /canines by the canonical /dogs.

-
+
 RewriteRule   ^/(puppies|canines)/(.*)    /dogs/$2  [R]
-
+
Discussion:
@@ -532,9 +534,9 @@ RewriteRule ^/(puppies|canines)/(.*) /dogs/$2 [R] This should really be accomplished with Redirect or RedirectMatch directives: -
+     
      RedirectMatch ^/(puppies|canines)/(.*) /dogs/$2
-     
+ @@ -563,10 +565,10 @@ using the following ruleset:

/about/:

-
-RewriteEngine on
+
+RewriteEngine on
RewriteRule ^/$ /about/ [R] -
+

Note that this can also be handled using the RedirectMatch directive:

@@ -603,11 +605,11 @@ that should go to an existing resource such as an image, or a css file. module="mod_dir">FallbackResource directive for this:

-
-<Directory /var/www/my_blog>
-  FallbackResource index.php
+<Directory /var/www/my_blog>
+ + FallbackResource index.php
+
</Directory> -

However, in earlier versions of Apache, or if your needs are more @@ -615,24 +617,22 @@ complicated than this, you can use a variation of the following rewrite set to accomplish the same thing:

-
-<Directory /var/www/my_blog>
-  RewriteBase /my_blog
-
-  RewriteCond /var/www/my_blog/%{REQUEST_FILENAME} !-f
-  RewriteCond /var/www/my_blog/%{REQUEST_FILENAME} !-d
-  RewriteRule ^ index.php [PT]
+<Directory /var/www/my_blog>
+ + RewriteBase /my_blog
+
+ RewriteCond /var/www/my_blog/%{REQUEST_FILENAME} !-f
+ RewriteCond /var/www/my_blog/%{REQUEST_FILENAME} !-d
+ RewriteRule ^ index.php [PT]
+ </Directory> -

If, on the other hand, you wish to pass the requested URI as a query string argument to index.php, you can replace that RewriteRule with:

-
   RewriteRule (.*) index.php?$1 [PT,QSA]
-

Note that these rulesets can be uses in a .htaccess -- 2.50.1