From 29da46e02ebed9af784043d9cb77394a2e1966f4 Mon Sep 17 00:00:00 2001 From: Rich Bowen Date: Wed, 5 Jan 2011 16:22:39 +0000 Subject: [PATCH] Add examples using . git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1055506 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/rewrite/remapping.html.en | 31 ++++++++++++++++++++++----- docs/manual/rewrite/remapping.xml | 31 ++++++++++++++++++++++----- 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/docs/manual/rewrite/remapping.html.en b/docs/manual/rewrite/remapping.html.en index 67ab7584a2..753810c969 100644 --- a/docs/manual/rewrite/remapping.html.en +++ b/docs/manual/rewrite/remapping.html.en @@ -284,11 +284,32 @@ hostname(s).

</VirtualHost> -

However, there are situations where you'll need to use mod_rewrite - -primarily when you don't have access to the main server configuration -file, or if you wish to do this dynamically for a larger number of -hostnames. For these situations, you might use one of the recipes -below.

+

You can alternatively accomplis this using the +<If> +directive:

+ +

+<If "%{HTTP_HOST} != 'www.example.com'">
+ +Redirect / http://www.example.com/ + +</If> +

+ +

Or, for example, to redirect a portion of your site to HTTPS, you +might do the following:

+ +

+<If "%{SERVER_PROTOCOL} != 'HTTPS'">
+ +Redirect /admin/ https://www.example.com/admin/ + +</If> +

+ +

If, for whatever reason, you still want to use mod_rewrite +- if, for example, you need this to work with a larger set of RewriteRules - +you might use one of the recipes below.

For sites running on a port other than 80:

diff --git a/docs/manual/rewrite/remapping.xml b/docs/manual/rewrite/remapping.xml
index adebef2748..39ee76eea7 100644
--- a/docs/manual/rewrite/remapping.xml
+++ b/docs/manual/rewrite/remapping.xml
@@ -286,11 +286,32 @@ hostname(s).

</VirtualHost>
-

However, there are situations where you'll need to use mod_rewrite - -primarily when you don't have access to the main server configuration -file, or if you wish to do this dynamically for a larger number of -hostnames. For these situations, you might use one of the recipes -below.

+

You can alternatively accomplis this using the +If +directive:

+ + +<If "%{HTTP_HOST} != 'www.example.com'">
+ +Redirect / http://www.example.com/ + +</If> +
+ +

Or, for example, to redirect a portion of your site to HTTPS, you +might do the following:

+ + +<If "%{SERVER_PROTOCOL} != 'HTTPS'">
+ +Redirect /admin/ https://www.example.com/admin/ + +</If> +
+ +

If, for whatever reason, you still want to use mod_rewrite +- if, for example, you need this to work with a larger set of RewriteRules - +you might use one of the recipes below.

For sites running on a port other than 80:

-- 
2.50.1